I am using xcodebuild to test my application in CI. I invoke it like this:
xcodebuild test -project myapp.xcodeproj -scheme myappTests -destination 'platform=iOS Simulator,name=iPhone 8,OS=14.4'
Text logged with the Logger from OSLog are not shown in debug level. So if I have something like this in my test, it isn't shown in the output of xcodebuild, but I would like to see that:
Logger(subsystem: "a", category: "b").debug("something")
Can I set the logging level of xcodebuild to debug? Messages with error level are shown.
I tried setting xcodebuildDebugLogLevel=3 but that gave me the same logging information.
Logger doesn't print debug (and trace) messages to the output because a log level of your subsystem on your simulator is INFO.
You can check this with next steps:
$ xcrun simctl list
...
-- iOS 15.2 --
iPhone 8 (C1D16369-D358-438E-8395-D01C2DE55980) (Shutdown)
...
$ xcrun simctl boot C1D16369-D358-438E-8395-D01C2DE55980
$ xcrun simctl spawn C1D16369-D358-438E-8395-D01C2DE55980 log config --subsystem <your-subsystem-name> --status
Mode for '<your-subsystem-name>' INFO PERSIST_DEFAULT
To change the current log level to DEBUG you can use next command:
$xcrun simctl spawn C1D16369-D358-438E-8395-D01C2DE55980 log config --subsystem <your-subsystem-name> --mode level:debug
Check again:
xcrun simctl spawn C1D16369-D358-438E-8395-D01C2DE55980 log config --subsystem <your-subsystem-name> --status
Mode for '<your-subsystem-name>' DEBUG PERSIST_DEFAULT
Now your tests with xcodebuild must have all debug (and trace) messages in the output.
Note: Console.app doesn't provide debug/trace messages even after changes from abobe and it's old known issue with simulators.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With