Did this blog help you solve a problem? Tip me with Bitcoins at: 17dQktcAmU4urXz7tGk2sbuiCqykm3WLs6

Friday, February 11, 2011

Debugging a Launchd Configuration on Mac OS X

Recently I set up a launchd configuration on my macbook that starts Tomcat up automatically during bootup. Of course it didn't work until after man hours of trial and error and combing Google for answers with a fine toothed comb. During part of the ordeal I came across a couple terminal commands for debugging Launchd. Here they are:

1. set the launcdctr log level to debug
sudo launchctl log level debug (debug, info, notice, warning, error, critical, alert, emergency)

2. Tail the system.log
tail -f /var/log/system.log

3. set the launcdctr log level back to error
sudo launchctl log level error

The possible log levels are as follows: debug, info, notice, warning, error, critical, alert, emergency.

Useful links I came across:
Creating launchd Daemons and Agents
Joel's Writings


Anonymous said...

no longer works on OS X 10.10

Andrew Mendelson said...

MacOS X 10.11 "El Capitan" includes what I assume is an equivalent command, "launchctl". See manual pages: launchctl(1), launchd(8), and launchd.plist(5). Alas, from the launchctl(1) page:

log [level loglevel] [only | mask loglevels...]
Get and set the syslog(3) log level mask. The available log lev-
els are: debug, info, notice, warning, error, critical, alert
and emergency. This subcommand is not implemented.

So I'm out of luck. Time to investigate passing editing launchd.plist(5) files in /System/Library/LaunchDaemons.

* (I'm really trying to debug configd, but not enough information is available in the system logs.)