Search code examples
perlsyslog

Sys::Syslog fails with invalid log level/ facility 0 when using LOG_EMERG


The code below is failing for LOG_EMERG. If I use any other level eg. LOG_ALERT this works without problems. Syslog documentation implies that this should work.

use strict;
use warnings;

require Sys::Syslog;
use Sys::Syslog qw(:standard :macros);
eval{Sys::Syslog::openlog('NAME', 'ndelay', 'local0')};
Sys::Syslog::syslog(Sys::Syslog::LOG_EMERG,"Message")

Solution

  • Perhaps a version issue: Latest version is currently at 0.29.

    to see what version your using try:

    perl -e "use Sys::Syslog; print $Sys::Syslog::VERSION;"