|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #49467 Errors are logged to syslog using LOG_NOTICE instead of LOG_ERR
Submitted: 2009-09-04 12:42 UTC Modified: 2016-06-02 12:36 UTC
Avg. Score:4.7 ± 0.5
Reproduced:7 of 7 (100.0%)
Same Version:1 (14.3%)
Same OS:3 (42.9%)
From: toby dot walsh at fxhome dot com Assigned: ab (profile)
Status: Closed Package: PHP options/info functions
PHP Version: * OS: *
Private report: No CVE-ID: None
 [2009-09-04 12:42 UTC] toby dot walsh at fxhome dot com
I'm using "error_log = syslog" in my php.ini to log all errors to syslog. But the errors end up being logged using the LOG_NOTICE log level instead of the LOG_ERR level.

I've traced this back to the internal php_log_err function in main/main.c which uses

php_syslog(LOG_NOTICE, "%.500s", log_message);

when it should probably be using

php_syslog(LOG_ERR, "%.500s", log_message); 

Reproduce code:
Set the following directives in php.ini
error_reporting = E_ALL & ~E_NOTICE
log_errors = On
error_log = syslog

Then generate a syntax error with something like
<?php test( ?>

Expected result:
An error message should be logged to syslog with a log level of LOG_ERR

Actual result:
The error message is logged, but using a log level of LOG_NOTICE instead of LOG_ERR


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-29 13:14 UTC]
-Package: Feature/Change Request +Package: PHP options/info functions
 [2010-12-29 13:15 UTC]
-Operating System: Linux +Operating System: * -PHP Version: 5.2.10 +PHP Version: *
 [2014-02-12 09:19 UTC] joop_boonen at web dot de
I also have exectly the same problem.
Will this issue be solved in the near future?

For me it would be an option that the default log level could be set. So that the logs aren't recorded as notice but my prefered log level.
But ofcource the only right solution would be that the logs would have the correct level, where you can also filter on.
 [2015-12-29 10:29 UTC] jani dot ollikainen at valve dot fi

Why would you want those to be using single level?

How about ?
 [2016-06-02 12:36 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: ab
 [2016-06-02 12:36 UTC]
PR #1702 merged for 7.1.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Sep 19 09:03:37 2021 UTC