Using syslog facilities with php error_log

北慕城南 提交于 2020-01-06 17:57:27

问题


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


回答1:


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);


来源:https://stackoverflow.com/questions/22569001/using-syslog-facilities-with-php-error-log

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!