
This video is only available to subscribers. Start a subscription today to get access to this and 484 other videos.
Streaming Logs with the log Tool
This episode is part of a series: Unified Logging and Activity Tracing.
Episode Links
Streaming Logs from your Mac
To stream logs from the terminal, use the log stream
command in Terminal. You can influence the level of logs you get back by using
log stream --debug
or
log stream --info
Streaming Logs from the Simulator
Doing the above will not include logs in the iOS Simulator. To stream these logs, you have to run the log utility within the booted simulator.
We can use simctl
to do this:
xcrun simctl spawn booted log ...
Filtering Based on Subsystem
If we want to limit the output just to one subsystem, we can filter using the --predicate
flag:
xcrun simctl spawn booted log stream --debug --predicate 'subsystem == "com.ficklebits.UnifiedLoggingDemo"'
Note that this takes an NSPredicate
type string, so you can do things like "subsystem CONTAINS[cd] 'foo'"
, filter on category
, or any of the other fields available to you.