swiftoslog

Swift macOS App - Enable Info/Debug Logging in Apple Console App


Implemented Apples unified logging system.

let logger = Logger(subsystem: "com.myapp.test", category: "someCategory")

I am trying to make the logging visible in Apples Console App, but it does not work for Info/ Debug Levels.

logger.info("Info Message") // not visible in Apple Console App

logger.error("Error Message") // visible in Apple Console App

In XCode it works just fine for all levels.

I have already configured logging for the subsystem:

sudo log config --mode "level:info" --subsystem com.myapp.test
sudo log config --status --subsystem com.myapp.test
Mode for 'com.myapp.test'  INFO PERSIST_OFF

What am i missing here?

macOS 12.4, XCode 13.3.1


Solution

  • I faced the same problem. Info and debug level messages must be activated in the Console application: Console > Action > Include Info Messages and Include Debug Messages.

    Take a look at Apple documentation at Include info or debug messages.