Hark ye, monks, particuarly ye sysadmin type monks.
I recently had a perl epiphany that I wish to shout from the mountain tops. It is simple and it is powerful. If you are a sysadmin, as I am, this is a wonderful thing.
$SIG{__DIE__} = sub { syslog("err", shift) };
This puts the "die" message into syslog. No more do you have to pepper your script with syslog calls next to each die, only to have your script actually die for some reason you either forgot to syslog or didn't manually die from.
Rejoice!
--Pileofrogs
Update:
Yes, use openlog. I just left it out to keep my example super short. Besides, the point is using $SIG{__DIE__} to call your logging routines, whatever they are.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: My proudest moment
by ikegami (Patriarch) on Oct 29, 2007 at 16:24 UTC | |
Re: My proudest moment
by grinder (Bishop) on Oct 29, 2007 at 17:20 UTC | |
by naikonta (Curate) on Oct 29, 2007 at 18:29 UTC | |
Re: My proudest moment (...::Syslog::Carp)
by tye (Sage) on Oct 29, 2007 at 19:45 UTC | |
Re: My proudest moment
by tfrayner (Curate) on Oct 30, 2007 at 18:08 UTC | |
Re: My proudest moment
by Dominus (Parson) on Nov 05, 2007 at 18:40 UTC |