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.

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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