aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine Beaupré <anarcat@koumbit.org>2013-09-07 18:25:46 -0400
committerAntoine Beaupré <anarcat@koumbit.org>2013-11-29 01:09:03 -0500
commit2869b65bcb5fa65ea0505c6fa513aeea9a0fbdc6 (patch)
tree194312bf66afdc7402dfe56d33ad785f964aaf9a
parentcca084b8ada6acf15cebaf320313d64b8c4107a7 (diff)
downloadikiwiki-2869b65bcb5fa65ea0505c6fa513aeea9a0fbdc6.tar
ikiwiki-2869b65bcb5fa65ea0505c6fa513aeea9a0fbdc6.tar.gz
recover gracefully from syslog failures
-rw-r--r--IkiWiki.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 87ddb1b56..2c0b1153c 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -728,6 +728,7 @@ sub debug ($) {
}
my $log_open=0;
+my $log_failed=0;
sub log_message ($$) {
my $type=shift;
@@ -738,9 +739,15 @@ sub log_message ($$) {
Sys::Syslog::openlog('ikiwiki', '', 'user');
$log_open=1;
}
- return eval {
+ eval {
Sys::Syslog::syslog($type, "[$config{wikiname}] %s", join(" ", @_));
};
+ if ($@) {
+ print STDERR "failed to syslog: $@" unless $log_failed;
+ $log_failed=1;
+ print STDERR "@_\n";
+ }
+ return $@;
}
elsif (! $config{cgi}) {
return print "@_\n";