in reply to Log::Log4perl syslog wall best practice

I don't know I'm probably missing something here but FWIW I've had good luck with Sys::Syslog

#!/usr/bin/perl -w # demonstration of writing to syslog from perl ## use strict; use warnings; use diagnostics; use Sys::Syslog qw(:DEFAULT setlogsock); my $fac = 'local1'; openlog( $0, 'cons,pid', $fac); syslog( 'notice', 'logging an event: %d', time); closelog();

Replies are listed 'Best First'.
Re^2: Log::Log4perl syslog wall best practice
by codeacrobat (Chaplain) on Mar 20, 2012 at 19:27 UTC

    Wow, that is exactly the sort of logging bloat, that I try to get rid of.

    With Sys::Syslog you have full control over syslog that is not the point.

    I am looking for an integrated solution with the Log::Log4perl framework. I would like to use a tiny set of log4perl configuration files with good defaults and a mix of screen and syslog appenders. Inexperienced programmers should be able to quit a script with something like LOGDIE("could not do foo with bar"); (and possibly a stacktrace where it makes sense.). So far this all seems to work nicely. That is until I found out that syslog walls every FATAL to every open terminal.

    Now do I really have to rollback every LOGDIE/LOGCROAK to a lengthy ERROR() and exit statement or is there a tweak to shutup syslog or use an equivalent nonfatal LOGDIE.

    print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});