|os_log(5)||File Formats Manual||os_log(5)|
os_log — logging
Logging configuration profiles are property list dictionaries that customize the behavior of the os_log(3) and os_signpost APIs.
Customization is on a subsystem and category basis, i.e., for particular os_log_t objects returned by os_log_create(3). Behavior involving the OS_LOG_DEFAULT constant is not affected by configuration profiles.
There are two types of logging configuration profiles, system-wide and application-specific.
Subsystem dictionaries are further organized into sub-dictionaries that correspond to categories. Subsystem dictionary keys are category names and values are dictionaries that define logging configuration settings for that subsystem and category.
The special DEFAULT-OPTIONS category key can be used to define common settings for all categories in a subsystem. (Settings in particular category dictionaries will take precedence over these common settings.)
Category dictionaries contain one or more of the following keys.
os_log(3) has three levels. In order from lowest to highest, they are: Debug, Info, and Default. Debug level is associated with os_log_debug; Info with os_log_info; and Default with os_log, os_log_error, and os_log_fault.
The system settings are that: Debug level logging is disabled; Info level is enabled and written to a memory buffer; Default level logging is enabled and persisted to disk.
If the following plist were at /System/Library/Preferences/Logging/Subsystems/com.example.plist, it would turn off logging for the "Transactions" category in the "com.example" subsystem. A profile or the log(1) config command could be used to turn it on when needed.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Transactions</key> <dict> <key>Level</key> <dict> <key>Enable</key> <string>Off</string> </dict> </dict> </dict> </plist>
If the following OSLogPreferences dictionary were in the Info.plist of an application, it would enable all levels and persist the Info and Default levels for the "Details" category in the "com.example" subsystem; and it would enable signpost backtraces for the "Measurements" category.
<key>OSLogPreferences</key> <dict> <key>com.example</key> <dict> <key>Details</key> <dict> <key>Level</key> <dict> <key>Enable</key> <string>Debug</string> <key>Persist</key> <string>Info</string> </dict> </dict> <key>Measurements</key> <dict> <key>Signpost-Backtraces-Enabled</key> <true/> </dict> </dict> </dict>
Application-specific logging configuration was introduced in macOS 10.15.
|June 24, 2019||Darwin|