启用 WARN 日志级别时,Supervisor 不会从应用程序收集日志

Supervisor is not collect logs from application when WARN loglevel enabled

我有 LEMP 复合 docker 容器,由 docker-compose.

编译

我需要将所有警告日志从我的 PHP-应用程序重定向到容器的 STDOUT 流; 仅当 supervisord loglevel=debug:

选项时有效
[supervisord]
nodaemon=true
loglevel=debug

然后,来自 PHP 应用程序的日志广播到 STDOUT:

lemp_1 | lemp_1 | 2017-07-11 19:09:29,524 DEBG 'php-fpm' stdout output: lemp_1 | [11-Jul-2017 19:09:29] WARNING: [pool www] child 13 said into stdout: "[2017-07-11 19:09:29] app.NOTICE: hello world [] []"

如果我将参数设置到 supervisord 部分 [supervisord]

loglevel=warn

(或信息、错误、警报等。)我的标准输出流中根本没有日志!
我需要传递给 activity 仅记录消息,具有 WARN 级别和更高级别。 supervisord "understands" 如何从应用程序收到什么级别的日志消息?
它可能对日志消息格式有任何规范吗? 还是设置不够?

主管配置:

[program:php-fpm]
command=php-fpm -F
autostart=true
autorestart=true
priority=5
stdout_events_enabled=true
stderr_events_enabled=true
redirect_stderr=true

[program:nginx]
command=nginx -g 'daemon off;'
autostart=true
autorestart=true
priority=10
stdout_events_enabled=true
stderr_events_enabled=true
redirect_stderr=true

[supervisord]
nodaemon=true
loglevel=debug

你需要告诉 supervisor 将容器的标准输出写入它自己的 supervisord 的日志,其中:

stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0

所以你的配置是:

[program:php-fpm]
command=php-fpm -F
autostart=true
autorestart=true
priority=5
stdout_events_enabled=true
stderr_events_enabled=true
stdout_logfile=/dev/stdout
stdout_logfile_maxbytes=0
redirect_stderr=true

[program:nginx]
command=nginx -g 'daemon off;'
autostart=true
autorestart=true
priority=10
stdout_events_enabled=true
stderr_events_enabled=true
redirect_stderr=true

[supervisord]
nodaemon=true
loglevel=debug