Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/229.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
Php 如何格式化Apache记录错误的方式?_Php_Apache - Fatal编程技术网

Php 如何格式化Apache记录错误的方式?

Php 如何格式化Apache记录错误的方式?,php,apache,Php,Apache,这是我得到的一个样本行: [Wed Dec 03 13:18:04.922126 2014] [:error] [pid 5328:tid 812] [client 172.16.0.28:55434] <<<error/warning message>>>>, referer: http://mydomain.iosif/messages [Wed Dec 03 13:18:04.922126 2014][:error][pid 5328:tid 8

这是我得到的一个样本行:

[Wed Dec 03 13:18:04.922126 2014] [:error] [pid 5328:tid 812] [client 172.16.0.28:55434] <<<error/warning message>>>>, referer: http://mydomain.iosif/messages
[Wed Dec 03 13:18:04.922126 2014][:error][pid 5328:tid 812][client 172.16.0.28:55434]>,参考:http://mydomain.iosif/messages
我需要这样的东西:

[Dec 03 13:18:04] <<<error/warning message>>>>
[Dec 03 13:18:04]>

为了便于调试,您可以在VirtualHost中设置日志格式。
或者使用函数解析日志

使正则表达式匹配并只显示所需的信息。我不太擅长正则表达式,但我仍然需要不同的日志,而不是不同的显示方式:)我看到了ErrorLogFormat指令,但我忽略了必须将其添加到VirtualHost的事实