KEXT_LOGGING(8) | System Manager's Manual | KEXT_LOGGING(8) |
kext logging
—
verbose/logging flags for kernel extensions (kexts) in the
kernel and command-line utilities
The kext management facilities of macOS allow for logging of kext
activity at all system levels, from the kernel to the user-space kext daemon
and most command-line kext tools. The -verbose
(-v
) flag of the tools provides a simple system of
levels that apply a set of lower level binary logging flags appropriate to
each tool, for maximally useful verbose output. The binary log specification
is used for kernel logging and is also available for use with the
-verbose
option when you need precise control over
logging.
For command-line tools the -verbose
(-v
) and -quiet
(-q
) flags control verbose output. The
-verbose
flag accepts a decimal level from 0-6 or a
hexadecimal log specification, both described below. The
-verbose
flag temporarily sets the log spec within
the kernel, and captures any log messages from the kernel to print along
with the tool's own log messages.
To enable kernel kext logging (in /var/log/kernel.log) on a long-term basis, use the kextlog boot arg or sysctl(8) parameter. You can set it as root using nvram(8) like so:
nvram boot-args=
"kextlog=0xlogspec other_boot_args"
where logspec is a hexadecimal log specification, as described below under “BINARY LOG SPECIFICATION”.
Caution: Enabling logging at a high level via boot arg can greatly slow down system startup time.
To change the kextlog setting at any time use sysctl(8):
sysctl -w debug.kextlog=0x
logspec
As mentioned, for the command-line kext tools you use the
-verbose
(-v
) flag, which
takes an optional argument that is either a decimal level from 0-6, or a
hexadecimal log specification (described under “BINARY LOG
SPECIFICATION”). The details of each level vary by tool, but in
general they are:
-verbose
flag also support a
-quiet
flag to suppress all output.The binary log specification is a 32-bit value comprising a log level with a bitmask divided into several regions from the least-significant nibble (corresponding to digits from right to left in a hexadecimal representation). This table describes the regions and bits used; unlisted regions and bits are reserved for future use:
-verbose
.
In addition, bit 0x8 of this nibble controls whether
kext-specific log messages are always printed.
kextcache(8) and kextunload(8) turn
this bit on with their -verbose
flag. See
“PER-KEXT LOGGING” for more information.
-verbose
flag always includes these. 8 bits
total.
-verbose
flag never includes
these. 20 bits total.
Many log messages apply to the kext being processed. The kernel and most of the command-line kext tools do not log these messages by default. You can enable these messages for an individual kext by specifying an OSBundleEnableKextLogging property in its Info.plist file with a boolean value of true. For convenience, kextutil(8) automatically sets this property for the kexts it is loading.
You can activate all per-kext log messages using level 6 with the
-verbose
flag or by turning on bit 0x8 in a
hexadecimal log specification. For convenience,
kextcache(8) and kextunload(8) do this
for all verbose levels of their -verbose
flag.
Here is a list of the exact hexadecimal log specifications applied
by each of the -verbose
levels:
kmutil(8), kernelmanagerd(8), syslog(1), kextcache(8), kextlibs(8), kextload(8), kextunload(8), kextutil(8)
March 6, 2009 | Darwin |