diff options
author | Niko Tyni <ntyni@iki.fi> | 2006-10-24 21:04:12 +0200 |
---|---|---|
committer | Niko Tyni <ntyni@iki.fi> | 2006-10-24 21:04:12 +0200 |
commit | 84c23d3be428bb2b2dc1d572e664b228b790dd3f (patch) | |
tree | dce5af978ad1109dd67d235d5c7c1645b5288a6f /lib/Smokeping.pm | |
parent | 242cc6534d04d0b226219f0cd0674b03a92b4816 (diff) | |
download | smokeping-84c23d3be428bb2b2dc1d572e664b228b790dd3f.tar.gz smokeping-84c23d3be428bb2b2dc1d572e664b228b790dd3f.tar.xz |
handle a dead syslogd (Debian bug #395056)
Diffstat (limited to 'lib/Smokeping.pm')
-rw-r--r-- | lib/Smokeping.pm | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm index 04e320d..3f76a7e 100644 --- a/lib/Smokeping.pm +++ b/lib/Smokeping.pm @@ -2705,12 +2705,22 @@ sub daemonize_me ($) { $syslog_priority = $pri if defined $pri; print "Note: logging to syslog as $syslog_facility/$syslog_priority.\n"; openlog(basename($0), 'pid', $syslog_facility); + eval { + syslog($syslog_priority, 'Starting syslog logging'); + }; + die("can't log to syslog: $@") if $@; } sub do_syslog ($){ my $str = shift; $str =~ s,%,%%,g; - syslog("$syslog_facility|$syslog_priority", $str); + eval { + syslog("$syslog_facility|$syslog_priority", $str); + }; + # syslogd is probably dead if that failed + # this message is most probably lost too, if we have daemonized + # let's try anyway, it shouldn't hurt + print STDERR qq(Can't log "$str" to syslog: $@) if $@; } sub do_cgilog ($){ |