Using syslog facilities with php error_log

2019-08-27 22:49发布

Is posible use syslog facilities in php error_log directive or in other way at system/server side?

Something like...

error_log = syslog:local4
error_log = syslog(LOG_LOCAL4)

Using php fpm I can set this with syslog.facility directive in fpm conf, but what about of php cli?

Thanks

标签: php syslog
1条回答
ら.Afraid
2楼-- · 2019-08-27 23:35

Php default syslog's facility is "user" (and cannot be changed)

I use directive auto_prepend_file in phi.ini (this script must be under include_path)

auto_prepend_file = log.php

and

root@sp:/etc/php5/cli# cat /usr/share/php5/log.php
<?php

openlog('php-cli', 0, LOG_LOCAL4);
查看更多
登录 后发表回答