summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/Smokeping.pm12
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 ($){