Re: PHP 4.0 Bug #1907: warnings and errors are logged to syslog instead of the conf'd error_log file
| From: | Oliver Billmann | Date: | Thu, 29 Jul 1999 22:37:35 +0000 |
| Subject: | Re: PHP 4.0 Bug #1907: warnings and errors are logged to syslog instead of the conf'd error_log file | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-9339@lists.php.net to get a copy of this message | ||
> oliver@billix.franken.de wrote:
>
> > error_reporting 15
> > display_errors On
> > track_errors Off
> > log_errors On
> > error_log /var/log/php4.log
> >
> > But the warnings and errors are still going to the syslog file :-(
>
> The same happened to me:
> (Apache 1.3.6/PHP4beta1/Postgres 6.5/Linux 2.3.11(RedHat)/i486)
>
> error_reporting = 7
> display_errors = Off
> log_errors = On
> track_errors = Off
> error_log = /var/log/php4_errors
>
> I think a workaround to this bug is to put an entry in /etc/syslog.conf like:
> facility.*
> /var/log/php4_errors
>
> But I don't know which facility to use; local[1-7].* does not seem to work.
After taking a quick look at main.c (where syslog gets called), the fix to
this bug is pretty easy ;-)
The following patch should fix it.
*** main.c Sun Jul 25 16:07:25 1999
--- main.c.org Fri Jul 30 00:33:38 1999
***************
*** 270,276 ****
/* Try to use the specified logging location. */
if (PG(error_log) != NULL) {
#if HAVE_SYSLOG_H
! if (strcmp(PG(error_log), "syslog")) {
syslog(LOG_NOTICE, log_message);
return;
} else {
--- 270,276 ----
/* Try to use the specified logging location. */
if (PG(error_log) != NULL) {
#if HAVE_SYSLOG_H
! if (!strcmp(PG(error_log), "syslog")) {
syslog(LOG_NOTICE, log_message);
return;
} else {
Maybe someone can put it into the CVS tree. Thanks.
Oliver
--
\\\///
+--------------------+ \\// +-----------------------------+
| Oliver Billmann | ( .. ) | oliver@billix.franken.de |
+--------------------+-ooO-(__)-Ooo-+-----------------------------+