Subject: | [regression] facility from openlog() is not used |
This code pattern worked for years:
use Sys::Syslog qw/ :DEFAULT :macros setlogsock /;
setlogsock('unix');
openlog('test-case', 'ndelay,pid', LOG_LOCAL7);
syslog(LOG_INFO, '%s', 'xxx1');
syslog(LOG_INFO, '%s', 'xxx2');
But in 0.33 it is no longer works - messages logged with wrong facility (zero).
This code works at least in 0.27 and seems to be broken by 0.31
Possible fix attached.
Subject: | patch-Syslog.pm.txt |
--- Syslog.pm.old 2013-05-24 00:10:00.000000000 +0000
+++ Syslog.pm 2013-11-20 09:52:49.000000000 +0000
@@ -365,7 +365,9 @@
if ($priority =~ /^\d+$/) {
$numpri = LOG_PRI($priority);
- $numfac = LOG_FAC($priority) << 3;
+ $numfac = LOG_FAC($priority) << 3;
+ # undef to use default if facility is not given in syslog()
+ undef $numfac if $numfac == 0; # undef to use default
}
elsif ($priority =~ /^\w+/) {
# Allow "level" or "level|facility".