在 IIS 上记录 PHP 信息日志时,事件查看器中的日志说明


Log description in Event Viewer while logging PHP information logs on IIS

我有一个PHP网站托管在Windows Server 2012上运行的IIS 8服务器上。我安装了 PHP 5.3.28。我想在事件查看器中记录信息消息。我尝试了以下代码:

openlog('php', LOG_CONS | LOG_NDELAY | LOG_PID, LOG_USER | LOG_PERROR);
syslog(LOG_INFO, 'This is a message');
closelog();

我在 php 中打开了error_reporting.ini并设置 error_log=syslog

以下是事件查看器中的条目:

The description for Event ID 2 from source PHP-5.3.28 cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.
If the event originated on another computer, the display information had to be saved with the event.
The following information was included with the event: 
php[10052]
This is a message

我觉得 php.ini 中需要一些配置,但我无法确定它会是什么,以便我可以为该日志消息提供通用描述。

您可以从这里下载注册文件将 PHP-5.3.99-dev 更改为您的版本,例如 PHP-5.7.0将 EventMessageFile 值从 g:''test''srctrunkinstall''php7ts.dll 更改为