You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4php-user@logging.apache.org by Chris Toomey <ct...@gmail.com> on 2011/08/13 02:31:50 UTC

Syslog appender bug?

Hi,

I'm getting the following error when trying to use the syslog appender:

PHP Warning:  openlog() expects parameter 3 to be long, string given in
/home/ctoomey/hg/CouponsCom/
webapp/zend/library/log4php/appenders/LoggerAppenderSyslog.php on line 190

It's passing the string I specified in the log4php.ini -- "LOCAL7" instead
of the corresponding int constant value.  So looks like this appender can't
possibly work when configuring from .ini or .xml files, or otherwise unless
you directly call setFacility() with a proper constant value.  Is anybody
using this appender and if so, how are you getting around this?

Also, do any of you know how to configure PHP to send STDERR messages to the
Apache error log?  When I use the Console appender with either STDERR or
STDOUT, my messages don't go into the apache error log and don't appear to
be logged anywhere.  On the other hand, msgs. I write with PHP's error_log()
do go to the error log.  Is anybody using the Console appender to
successfully write to apache's error log?

thx,
Chris

Re: Syslog appender bug?

Posted by Chris Toomey <ct...@gmail.com>.
Ok, thanks Ivan and enjoy the kayaking :-).

Chris

On Fri, Aug 12, 2011 at 10:53 PM, Ivan Habunek <iv...@gmail.com>wrote:

> Hi Chris,
>
> I can confirm that this is a bug. The facility cannot be configured using
> the strings as specified in the documentation. I will open an issue and we
> will fix this.
>
> In the meantime, you can use the integer values of the PHP constants used
> for syslog facility, as listed here:
> http://www.php.net/manual/en/network.constants.php
>
> For example, if you want to use the LOCAL7 facility, you need to use the
> integer value of the LOG_LOCAL7 constant which is 184. Therefore, something
> like:
> log4php.appender.default = LoggerAppenderSyslog
> log4php.appender.default.facility = 184
>
> I will have to get back to you concerning the other issue, I'm off kayaking
> today. :-)
>
> Thanks for reporting the bug.
>
> Best regards,
> Ivan
>
>
>
> On 13 August 2011 02:31, Chris Toomey <ct...@gmail.com> wrote:
>
>> Hi,
>>
>> I'm getting the following error when trying to use the syslog appender:
>>
>> PHP Warning:  openlog() expects parameter 3 to be long, string given in
>> /home/ctoomey/hg/CouponsCom/
>> webapp/zend/library/log4php/appenders/LoggerAppenderSyslog.php on line 190
>>
>> It's passing the string I specified in the log4php.ini -- "LOCAL7" instead
>> of the corresponding int constant value.  So looks like this appender can't
>> possibly work when configuring from .ini or .xml files, or otherwise unless
>> you directly call setFacility() with a proper constant value.  Is anybody
>> using this appender and if so, how are you getting around this?
>>
>> Also, do any of you know how to configure PHP to send STDERR messages to
>> the Apache error log?  When I use the Console appender with either STDERR or
>> STDOUT, my messages don't go into the apache error log and don't appear to
>> be logged anywhere.  On the other hand, msgs. I write with PHP's error_log()
>> do go to the error log.  Is anybody using the Console appender to
>> successfully write to apache's error log?
>>
>> thx,
>> Chris
>>
>>
>

Re: Syslog appender bug?

Posted by Ivan Habunek <iv...@gmail.com>.
Hi Chris,

I can confirm that this is a bug. The facility cannot be configured using
the strings as specified in the documentation. I will open an issue and we
will fix this.

In the meantime, you can use the integer values of the PHP constants used
for syslog facility, as listed here:
http://www.php.net/manual/en/network.constants.php

For example, if you want to use the LOCAL7 facility, you need to use the
integer value of the LOG_LOCAL7 constant which is 184. Therefore, something
like:
log4php.appender.default = LoggerAppenderSyslog
log4php.appender.default.facility = 184

I will have to get back to you concerning the other issue, I'm off kayaking
today. :-)

Thanks for reporting the bug.

Best regards,
Ivan


On 13 August 2011 02:31, Chris Toomey <ct...@gmail.com> wrote:

> Hi,
>
> I'm getting the following error when trying to use the syslog appender:
>
> PHP Warning:  openlog() expects parameter 3 to be long, string given in
> /home/ctoomey/hg/CouponsCom/
> webapp/zend/library/log4php/appenders/LoggerAppenderSyslog.php on line 190
>
> It's passing the string I specified in the log4php.ini -- "LOCAL7" instead
> of the corresponding int constant value.  So looks like this appender can't
> possibly work when configuring from .ini or .xml files, or otherwise unless
> you directly call setFacility() with a proper constant value.  Is anybody
> using this appender and if so, how are you getting around this?
>
> Also, do any of you know how to configure PHP to send STDERR messages to
> the Apache error log?  When I use the Console appender with either STDERR or
> STDOUT, my messages don't go into the apache error log and don't appear to
> be logged anywhere.  On the other hand, msgs. I write with PHP's error_log()
> do go to the error log.  Is anybody using the Console appender to
> successfully write to apache's error log?
>
> thx,
> Chris
>
>