在MAC OSX上使用Python的SyslogHandler时,DEBUG和INFO消息会发送到哪里? [英] Where do DEBUG and INFO messages go when using Python's SyslogHandler on MAC OSX?

查看:73
本文介绍了在MAC OSX上使用Python的SyslogHandler时,DEBUG和INFO消息会发送到哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用SysLogHandler配置了一个Python记录器,并作为测试记录了使用所有级别的一些消息:调试,信息,警告,错误,严重.如果我运行"syslog"或查看Console.app显示屏,我会看到所有消息.因此,所有消息均已正确记录.但是,当我tail /var/log/messages.log时,我看不到DEBUG和INFO消息.我读到有关ASL的信息,我看到一个名为/var/log/asl的充满二进制文件的目录,但我完全不了解它与syslog的交互方式.

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.

推荐答案

使用man syslogman asl(ASL = Apple系统日志)和man aslmanager,您会发现有一个配置文件/etc/asl.conf和默认版本包含以下行:

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

因此,位于DEBUG和INFO的此消息不会由ASL存储,这反过来意味着事后syslog不能打印它们. syslog程序似乎是从二进制ASL文件而不是文本/var/log/messages.log文件读取存储的数据.

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.

如果编辑/etc/asl.conf文件,则可以更改级别以记录INFO和DEBUG消息.您需要重新启动ASL守护程序(syslogdaslmanager)或重新启动计算机,并且可能需要注意使用的空间(因为未存储DEBUG和INFO消息的原因)是因为它们倾向于非常庞大).

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).

这篇关于在MAC OSX上使用Python的SyslogHandler时,DEBUG和INFO消息会发送到哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆