13

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?

jxramos
  • 7,356
  • 6
  • 57
  • 105
Gaetano Causio
  • 131
  • 1
  • 7
  • 1
    Do you really need to configure logging system (via `sudo log config`)? To observe log stream this should work: `log stream --level debug --predicate 'subsystem == "com.myapps"'`. – Vlad Sep 30 '16 at 22:36
  • @Vlad: according to Apple documentation: "debug-level messages are only captured when debug logging has been explicitly enabled via the log command-line tool or a custom logging profile". Via de `log stream` command I do see indeed all the log types, but not via the new Mac Console. – Gaetano Causio Oct 02 '16 at 21:30
  • https://carpeaqua.com/2017/03/22/debug-and-info-unified-logging/ – Oleg Aug 16 '17 at 12:33
  • This question is not a duplicate (the other question concerns iOS, this question is about macOS). The answer for the supposedly duplicate question (use the menu items in Console.app) does not work when debugging a macOS app attached to Xcode. – Jakob Egger Mar 27 '18 at 14:22
  • If someone arrives here from Google, here's my answer: I have found no way to enable debug messages in Console.app. The only way to see them is using `log stream --level=debug --process $(pgrep my-app-name)` – Jakob Egger Mar 27 '18 at 14:38
  • You can post your own answer as an Answer instead of a comment, and set it to be the accepted answer. I spent much time looking for it... – Motti Shneor Nov 22 '20 at 07:46

1 Answers1

-2

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.

Chris
  • 11
  • 1
  • that's indeed what I did with: `sudo log config --mode "persist:debug,level:debug" --subsystem com.myapps` as stated in my question. But it does not work. – Gaetano Causio Sep 24 '16 at 08:17