]> git.ipfire.org Git - people/stevee/guardian.git/blobdiff - guardian
Redirect the "die" messages to the logger.
[people/stevee/guardian.git] / guardian
index ba8e99cf52400c8c92cebdbdc2a1441cf53cd95c..da9665cc8e8fb0d561655722707a66f72e3e510d 100644 (file)
--- a/guardian
+++ b/guardian
@@ -73,6 +73,9 @@ my %mainsettings = &Guardian::Config::UseConfig($cmdargs{"config"});
 my $logger = Guardian::Logger->New(%mainsettings);
 $logger->Log("debug", "Logger successfully initialized...");
 
+# Redirect perls "die" messages to the logger before exiting.
+$SIG{__DIE__} = sub { $logger->Log("err", "@_"); };
+
 # Shared hash between the main process and all threads. It will store all
 # monitored files and their current file position.
 my %monitored_files :shared = ();