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

All my logs are getting into stderror_logfile and not stdout_logfile

我正在使用 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 为空。

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

如果出于某种原因你想使用 stdout 而不是 stderr(请注意,尽管有名称,stderr 并不意味着发生了任何类型的 "error"),你必须在 Python 的 logging 模块。