我的所有日​​志都进入stderror_logfile而不是stdout_logfile

时间:2017-05-23 09:48:52

标签: logging tornado supervisord

我正在使用supervisord从tornado应用程序捕获日志,我的所有日​​志都进入stderror_logfile。主管如何决定所有日志都应该进入stderror_logfile。我的配置如下所示。

stdout_logfile=../../logs/triniti-log.log        ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)
;stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
stdout_capture_maxbytes=1MB   ; number of bytes in 'capturemode' (default 0)
;stdout_events_enabled=false   ; emit events on stdout writes (default false)
stderr_logfile=../../logs/stderr-log.log        ; stderr log path, NONE for none; default AUTO
stderr_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)

stdout_logfile为空。

1 个答案:

答案 0 :(得分:1)

Stderr是Tornado使用的default for python's logging module(这也是其他日志库的常见做法)。 Tornado允许您使用--log-file-prefix命令行参数将日志输出定向到(系列)文件(如果您使用tornado.options.parse_command_line(),但不提供任何使用stdout的选项。

如果由于某种原因想要使用stdout而不是stderr(注意,尽管有名称,stderr并不意味着发生了任何类型的“错误”),你必须在Python的{{1}中配置它模块。

相关问题