Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do DEBUG and INFO messages go when using Python's SyslogHandler on MAC OSX?

I configured a Python logger with a SysLogHandler and as a test logged some messages using all the levels: debug, info, warning, error, critical. I see all my messages if I run 'syslog' or if I look at the Console.app display. So, all the messages are logged correctly. But, when I tail /var/log/messages.log I don't see the DEBUG and INFO messages. I read about ASL and I see a directory called /var/log/asl full of binary files, but I didn't understand exactly how it interacts with syslog if at all.

like image 403
Pyramid Newbie Avatar asked Feb 25 '14 04:02

Pyramid Newbie


1 Answers

Using man syslog, man asl (ASL = Apple System Log) and man aslmanager, you'll find that there's a configuration file /etc/asl.conf and the default version contains the lines:

# save everything from emergency to notice
? [<= Level notice] store

This messages at DEBUG and INFO are therefore not stored by ASL, which in turn means they can't be printed by syslog after the fact. The syslog program appears to read the stored data from the binary ASL files and not from the text /var/log/messages.log file.

If you edit the /etc/asl.conf file, you could change the Level to record INFO and DEBUG messages. You'd need to restart the ASL daemons (syslogd, aslmanager), or reboot the computer, and you'd probably need to keep an eye on the space used (because the reason that DEBUG and INFO messages are not stored is that they are apt to be very voluminous).

like image 64
Jonathan Leffler Avatar answered Sep 21 '22 01:09

Jonathan Leffler