in reply to Re: Sys::Syslog and LOG_EMERG
in thread Sys::Syslog and LOG_EMERG

hmmm... nice guess, but it still doesn't work.

The code:

use Sys::Syslog qw(:standard :macros); openlog('foo', '', 'user'); syslog(LOG_EMERG,"%s","Foo");

...produces the same error.

Replies are listed 'Best First'.
Re^3: Sys::Syslog and LOG_EMERG
by Crackers2 (Parson) on Aug 11, 2006 at 23:17 UTC

    Looks like a real bug in Sys::Syslog. Below the code from Syslog.pm around line 632:

    if ($_ eq 'kern' || $num <= 0) { croak "syslog: invalid level/facility: $_" }

    Changing this to

    if ($_ eq 'kern' || $num < 0) { croak "syslog: invalid level/facility: $_" }

    makes the code work for me.

    Update:Of course that change means you won't get an error message anymore if you forget to specify a priority (e.g. syslog(LOG_USER,"test")). I'm sure someone will come up with the right solution though.