Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/282.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么supervisord不记录我的PHP CLI写入(STDOUT,“message”?)?_Php_Command Line Interface_Supervisord - Fatal编程技术网

为什么supervisord不记录我的PHP CLI写入(STDOUT,“message”?)?

为什么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

我有一个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
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“