为什么supervisord不记录我的PHP CLI写入(STDOUT,“message”?)?
我有一个PHP命令行应用程序(zconsole awswebhookrunner),由supervisord运行 Supervisord不会登录文件为什么supervisord不记录我的PHP CLI写入(STDOUT,“message”?)?,php,command-line-interface,supervisord,Php,Command Line Interface,Supervisord,我有一个PHP命令行应用程序(zconsole awswebhookrunner),由supervisord运行 Supervisord不会登录文件fwrite(STDOUT,“message”),但会记录echo“message” 管理命令配置 [program:aws_webhook] command=/home/(username)/bin/zconsole awswebhookrunner process_name=%(program_name)s_%(process_num)02d n
fwrite(STDOUT,“message”)
,但会记录echo“message”
管理命令配置
[program:aws_webhook]
command=/home/(username)/bin/zconsole awswebhookrunner
process_name=%(program_name)s_%(process_num)02d
numprocs=1
directory=/tmp
priority=999
autostart=true
autorestart=true
startretries=100
stopwaitsecs=10
user=(username)
stdout_logfile=/home/(username)/logs/aws_webhook_runner.out.log
stderr_logfile=/home/(username)/logs/aws_webhook_runner.err.log
stdout_logfile_maxbytes=10MB
PHP代码
private function log($message, $type="info")
{
$output=STDIN;
switch ($type) {
case "error":
$output=STDERR;
break;
default:
$output=STDIN;
}
$to_log=date("Y-m-d H:i:s")." ".$message;
fwrite($output,$to_log.PHP_EOL) ;
//echo $to_log.PHP_EOL;
fflush($output);
unset($to_log);
}
软件版本
PHP version: 5.3.3
OS: CentOS 6.10
supervisord: 3.3.5
问题
supervisord
设置正确吗fwrite(STDOUT | STDERR,$message)的行为代码>
echo$消息代码>如果发送到STDOUT是否有效
STDIN
而不是STDOUT
STDIN
用于输入supervisorORD
我认为不处理STDIN李>
echo
将打印到STDOUT,因为这是它的默认行为$output=STDIN
你确定这就是你想要的吗?应该是STDOUT
现在在PHP5.3中不确定,但我会做fopen('php://stdout“,”w“
。