I added an internal log file that only keeps the most recent 10,000 lines of 
logging and then save it internally.  There is an option within my old app that 
lets the user email that to me with the click of a button.  It’s been foolproof.

Might work for you.

Cheers,
Alex Zavatone

> On Jul 14, 2023, at 8:09 AM, Gabriel Zachmann via Cocoa-dev 
> <cocoa-dev@lists.apple.com> wrote:
> 
> I have an app that logs messages (info and errors) as follows:
> 
>    ...
>    log_client_ = os_log_create( "de.zach.MyApp", "MyApp" );  
>    ...
> 
> void logMessage( NSString* msg, bool is_error )
> {
>    if ( [ msg canBeConvertedToEncoding: NSUTF8StringEncoding] )
>        msg_string = [msg UTF8String];
>    else
>        msg_string = [[msg dataUsingEncoding: NSASCIIStringEncoding 
> allowLossyConversion: YES] bytes];
>    if ( is_error )
>        os_log_error( log_client_, "%{public}s", msg_string );
>    else
>        os_log_info( log_client_, "%{public}s", msg_string );
> }
> 
> 
> Occasionally, users send me their log files, but they contain only a small 
> subset of all the message my app outputs!
> 
> I am interested in messages like this:
> 
> 2023-07-12 15:12:47.177849-0400 0x3bffc0   Info        0x5e4dc3             
> 21784  0    MyApp: [de.zach.MyApp:MyApp] writing preferences (display name = 
> HDMI)
> 
> The message "writing preferences .." is an example message I output in my app.
> 
> I get a lot of other messages that I don't output; I guess they are output by 
> some framework I'm using, such as:
> 
> 2023-07-12 15:12:23.437424-0400 0x3bffc0   Info        0x0                  
> 21784  0    MyApp: (HIToolbox) [com.apple.HIToolbox:MBDisplays] <private>
> 
> That's fine with me, except that a lot of the messages that I do output are 
> missing!
> 
> Users extract the log message using this command in Terminal:
> 
> % log show --predicate 'process == "MyApp"' --info --debug > ~/Desktop/Log.txt
> 
> Naturally, this command works fine on my machine, and I get all the messages 
> I am expecting.
> 
> This is all happening under macOS 13 (Ventura).
> 
> 
> Big question: why is it that the log files from users sometimes do not 
> contain all the messages my app outputs??
> They all occur on the same day, and users extract and send their log files on 
> the same day the problem occurs.
> 
> 
> Any ideas and hints will be highly appreciated!
> 
> Best, G.
> 
> _______________________________________________
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
> 
> This email sent to z...@mac.com

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to