From: Kevin G. <ke...@go...> - 2003-01-07 16:51:03
|
Manju: We had a discussion about this topic back around the end of November (threads are "Same appender attached to different loggers" and "one appender, many categories"). The upshot was that we fixed the behavior of log4perl to match that of log4j, which does what you observed: if you have an appender attached to category "tree" and also attached to "tree.branch.leaf", messages sent to "tree.branch.leaf" will show up in that appender twice. However, forseeing objections like yours, we did log4j one better and added an as-yet undocumented feature, you can set log4perl.oneMessagePerAppender = 1 in your config file (for log4perl v 0.27). Unless there are any objections, I think we should consider this a motion to add oneMessagePerAppender as a bona-fide feature. Manju Ramanathpura wrote: > Hello there, > > I have attatched a sample configuration file and a test perl script > along with the email. > > Could you please explain me why is the logger logging the messages twice?? > > This example is very similar to the one you have explained in the > documentation and I am puzzled by the fact that logger is duplicating > the log messages coming from the package Ticket.pm. Although overriding > the parent logger setting seems to be working, I am not able to > figureout why is it duplicating?? > > Am I using it wrong? > > Thanks, > > -Manju > > > ------------------------------------------------------------------------ > > log4perl.logger=FATAL, Screen > log4perl.logger.CCBU.Patch=ERROR, Log > log4perl.logger.CCBU.Patch.Ticket=WARN,Log > > > > log4perl.appender.Screen=Log::Dispatch::Screen > log4perl.appender.Screen.stderr=0 > log4perl.appender.Screen.Threshold=FATAL > log4perl.appender.Screen.layout=Log::Log4perl::Layout::PatternLayout > log4perl.appender.Screen.layout.ConversionPattern=%d %p> %F{1}:%L %M - %m%n > > log4perl.appender.Log=Log::Dispatch::File > log4perl.appender.Log.filename=test.log > log4perl.appender.Log.mode=append > log4perl.appender.Log.layout=Log::Log4perl::Layout::PatternLayout > log4perl.appender.Log.layout.ConversionPattern=%d %p> %F{1}:%L %M - %m%n > > > > ------------------------------------------------------------------------ > > #!perl-w > > use 5.006001; > use strict; > use warnings; > use Log::Log4perl qw(get_logger :levels); > use CCBU::Patch::Ticket > > > > Log::Log4perl->init("logsetup.conf"); > > my $logger = get_logger("CCBU::Patch"); > > > my $food = what_food_sub("Sushi"); > > $logger->info("Food in main is : $food"); > $logger->info("And the conume is ".consume($food)); -- Happy Trails . . . Kevin M. Goess (and Anne and Frank) 904 Carmel Ave. Albany, CA 94706 (510) 525-5217 |