in reply to Log4Perl configuration problems

the documentation for log4perl sucks massively
That's both harsh and completely unfair. In fact, I think the Log::Log4perl documentation is both extensive and well written. Courtesy never hurts, and sometimes helps.
2. How can one do the following (non-working example):
You can log both to screen (stderr) and a rotating file like this:
use Log::Log4perl; use Log::Dispatch::FileRotate; my $conf = undef; my $log = undef; my $help = undef; my $test = undef; my $file = undef; $conf = q( log4perl.category.Script = INFO, ScreenAppender, ScriptFile +RotateAppender log4perl.appender.ScreenAppender = Log::Log4perl::Appender:: +Screen log4perl.appender.ScreenAppender.stderr = 1 log4perl.appender.ScreenAppender.layout = PatternLayout log4perl.appender.ScreenAppender.layout.ConversionPattern=[%p] %d %F +:%L - %m%n log4perl.appender.ScreenAppender.Threshold = DEBUG log4perl.appender.ScriptFileRotateAppender = Log::Dispatch +::FileRotate log4perl.appender.ScriptFileRotateAppender.filename = script.log log4perl.appender.ScriptFileRotateAppender.mode = append log4perl.appender.ScriptFileRotateAppender.size = 100000 log4perl.appender.ScriptFileRotateAppender.max = 5 log4perl.appender.ScriptFileRotateAppender.layout = PatternLayout log4perl.appender.ScriptFileRotateAppender.layout.ConversionPattern= +[%p] %d %F:%L: %m%n ); Log::Log4perl::init( \$conf ); $log = Log::Log4perl::->get_logger(q(Script)); $log->debug("start") if $log->is_debug(); $log->warn("stop") if $log->is_warn();
--
No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]

Replies are listed 'Best First'.
Re^2: Log4Perl configuration problems
by ribasushi (Pilgrim) on Jun 13, 2008 at 11:58 UTC
    That's both harsh and completely unfair. In fact, I think the Log::Log4perl documentation is both extensive and well written. Courtesy never hurts, and sometimes helps.
    I am happy you feel this way about the massively incomplete documentation. Just to prove my point - tell me where in the docs is .Threshold being discussed? Certainly not in Log::Log4perl, nor in Log::Log4perl::Config (the only two places where a seasoned CPAN user would look). The only place I found this modifier (after your hint) was in the FAQ, and even then - it was in sections completely unrelated to my problem.

    Thank you, nevertheless, for pointing me in the right direction. I stand by my words however.
      The References section has a link to an article that complements the documentation well. It says (on page 3):
      Each appender can define a so-called appender threshold, a minimum level required for an oncoming message to be honored by the appender:
      $appender->threshold($ERROR);
      If the level doesn't meet the appender's threshold, then it is simply ignored by this appender.
      Was that what you were looking for?
      --
      No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]