Xcode 8 - os_log_debug and os_log_info logs are no

2019-02-09 06:08发布

This question already has an answer here:

I'm trying out the new Unified Logging in Xcode 8 and Objective-C. It works fine, but it seems the logs of type debug and info are not shown on the new Mac Console. Other logs types (error, fault, default) are all displayed correctly.

On Xcode 8 I have:

os_log_t logObject = os_log_create("com.myapps", "testing log");
os_log(logObject, "Default log message."); // Captured and shown correctly
os_log_info(logObject, "Info log message."); // Not shown on Console app
os_log_debug(logObject, "Debug log message.");  // Not shown on Console app
os_log_error(logObject, "Error log message.");  // Captured and shown correctly
os_log_fault(logObject, "Fault log message.");  // Captured and shown correctly

On terminal I issued:

sudo log config --mode "persist:debug,level:debug" --subsystem com.myapps

And this is what I get:

screenshot logs on Mac console

Any idea about what am I missing?

NB: How can my question be considered duplicate as it was asked at least 7 month before the one of @algal?

1条回答
混吃等死
2楼-- · 2019-02-09 06:46

Info and Debug levels have to be manually enabled via the command-line or by installing a logging profile. See section Customizing Logging Behavior While Debugging of the Logging documentation for details.

查看更多
登录 后发表回答