Log4perl: Category Logging at a Different Level than Root
(This is probably intuitively obvious to everyone else...)
Here is a sample Log::Log4perl configuration where the root logs at WARN, package 'Joe' logs at 'INFO', and package 'Zoe::Marie' logs at ERROR:
log4perl.rootLogger=WARN, LOGFILE log4perl.logger.Joe=INFO, LOGFILE log4perl.logger.Zoe.Marie=ERROR, LOGFILElog4perl.additivity.Joe = 0
log4perl.additivity.Zoe.Marie = 0
log4perl.appender.LOGFILE=Log::Log4perl::Appender::File
log4perl.appender.LOGFILE.filename=/tmp/test-Log4perl.log
log4perl.appender.LOGFILE.mode=append
log4perl.appender.LOGFILE.layout=PatternLayout
log4perl.appender.LOGFILE.layout.ConversionPattern=[%r] %F %L %c - %m%n
Because of how Log::Log4perl was built, you don't need to do anything special in your code to support this multi-level priority logging -- each package can just use Log::Log4perl->get_logger() to get the the logging object and it all falls out in the wash.
(In theory, this type of configuration should work for Log4j and Log4net also.)
Perl/CPAN user since 1992.
Please note that sometimes you will need to specify the category for get_logger, as in Log::Log4perl->get_logger('CATEGORY').
Sorry that I'm not sure yet when this is needed -- I've just started working with Log::Log4perl.