Conversation

OSLog is killing me. As a last ditch effort to investigate some bug I cannot repro locally, I added some debug (and various other levels) to my TestFlight build. Looking at Console.app, I see them show up maybe 5% of the time. I don't get it - an SPM package I'm using is logging just fine.

I haven't used OSLog much, at least not for this. Anyone else run into problems?

4
0
0

@jefframes @davedelong had a bunch of interesting things to say recently about various logger frameworks including OSLog. Check it out https://mastodon.social/@davedelong/112254731118071587

1
0
0

@Drmarkpowell wow that pretty much hit the nail right on the head. Thanks!

0
0
0

@jefframes Same here. Can’t persist/extract them the way you like. I resorted to using a 3rd party solution.

1
0
0
@jefframes I switched to OSLog because of the Xcode console logging improvements, but when it came to a bug in the app for a different user, I realized that there was no way to get logs other than from the current session — which was totally useless for my purposes since I needed the logs from the previous few sessions too …

So I actually wrote my own logger (very basic, very simple) which saves to a text files and which the user can send me via email (as a ZIP file) from within the app with one tap.

That has worked beautifully so far for my own use cases.
1
0
1

@jefframes The only issue I’ve encountered is that I noticed that print will happily display many details about some Weatherkit data I passed to it but OSLog would not.

2
0
0

@funkyboy I just wanted something super lightweight and quick for one-time use. Can't believe this isn't doable with first-party stuff. I ended up just writing logs to a file and attaching them to a MailPicker. So much wasted time before giving up!

1
0
0

@f I agree with everything you said there! OSLog is awesome in the Xcode Console.

I ended up doing exactly what you did - a quick text field logger and a mail picker. At least I know to start there next time I have a one-off like this.

0
0
0

@MuseumShuffle @jefframes Chris, are you encountering its redaction behavior? By default it will redact any interpolations, it only shows literals. But you can flag an interpolated value as safe to display. There’s also a hashing feature if it’s a value you want to track but don’t want to be visible. https://developer.apple.com/documentation/os/oslogprivacy

1
0
0

@jefframes @MuseumShuffle Jeff, I’m not sure why you’re not seeing them in Console.app, I usually have good luck there but there have been times it’s missing. Sometimes those filter options are extra finnicky feeling 😔

0
0
0

@jefframes I ended up using the good old Cocoalumberjack. I can decide where to store logs, for how long and even attach them as a zip file to a support email.
All of the above, being privacy sensitive.

0
0
0

@cwagdev @jefframes I don't think it was that because it was just some weather data. Regular print would show me lots of detailed data. OSLog did not.

1
0
0

@MuseumShuffle @jefframes it doesn’t matter what it is, it redacts everything by default.

1
0
0

@cwagdev @jefframes I haven't been seeing weather data be redacted. In fact, they might have addressed the issue I was seeing because I'm seeing lots of data logged now when I try OSLog again with the returned data.

1
0
0

@MuseumShuffle @jefframes Xcode’s console may behave differently than Console.app here, I can’t recall at the moment.

0
0
0