rootcho has asked for the wisdom of the Perl Monks concerning the following question:

in log4jperl what are the differences between :
log4perl.rootLogger log4perl.logger log4perl.category
The only way I was able to direct ERRORS to separate file was to use :
'log4perl.rootLogger' => 'DEBUG, Screen,AppLog', 'log4perl.rootLogger.ERRORS' => 'ERROR, errorsAppender'
Next step will be to save errors only at errorsAppender , I think I had to use 'additivity'!?
Other question would be how can I switch off 'Screen' appender on the fly in the code ?

PS> my mistake log4perl.rootLogger.ERRORS, didn't work!!
filter worked, but if you know of a better solution ?
'log4perl.rootLogger' => 'DEBUG, Screen,AppLog,errors', 'log4perl.filter.MatchErr' => 'Log::Log4perl::Filter::LevelM +atch', 'log4perl.filter.MatchErr.LevelToMatch' => 'ERROR', 'log4perl.filter.MatchErr.AcceptOnMatch' => 'true', 'log4perl.appender.errors.Filter' => 'MatchErr',

Replies are listed 'Best First'.
Re: Log4j logger's
by Anonymous Monk on Mar 16, 2011 at 20:36 UTC
    in log4jperl what are the differences between rootLogger/category/logger

    This is answered in the introductory Retire your debugger, log smartly with Log::Log4perl!, basically it is hierarchical, rootLogger is the root of all loggers, all loggers inherit from root, and loggers are just another name for categories (in log4j, Loggers deprecated, they are a subclass of Category)

Re: Log4j logger's
by Anonymous Monk on Mar 16, 2011 at 20:08 UTC
    Other question would be how can I switch off 'Screen' appender on the fly in the code ?

    Don't, use a different log4perl.logger, one which doesn't print to screen