From: Enzer, M. B. S. <mat...@ba...> - 2006-02-03 00:24:47
|
> From: Mike Schilli [mailto:m...@pe...]=20 > > my $logger =3D get_logger("mycat"); >=20 > $logger->debug("both appenders"); >=20 > Log::Log4perl->appender_thresholds_adjust(+1, ['Screen1']); >=20 > $logger->debug("one appender"); > $logger->info("both appenders again"); Thanks. I think will work for what I need to do, but just to be completely clear, if I understand this correctly, you may only adjust the appender threshold on a per-appender basis, not per category/appender pair, so the following WON'T work: my $conf =3D q{ log4perl.logger.mycat =3D DEBUG, Screen1, Screen2 log4perl.logger.another_cat =3D DEBUG, Screen1, Screen2 log4perl.appender.Screen1 =3D Log::Log4perl::Appender::Screen log4perl.appender.Screen1.layout =3D SimpleLayout log4perl.appender.Screen1.Threshold =3D DEBUG log4perl.appender.Screen2 =3D Log::Log4perl::Appender::Screen log4perl.appender.Screen2.layout =3D SimpleLayout log4perl.appender.Screen2.Threshold =3D DEBUG }; Log::Log4perl->init(\$conf); my $logger =3D get_logger("mycat"); my $another_logger =3D get_logger("different_cat"); $logger->debug("both appenders"); Log::Log4perl->appender_thresholds_adjust(+1, ['Screen1']); $logger->debug("one appender"); $logger->info("both appenders again"); $another_logger->debug("both appenders"); # Uh oh, goes to only Screen2=20 =20 This message and any attachments are confidential, proprietary, and may = be privileged. If this message was misdirected, Barclays Global = Investors (BGI) does not waive any confidentiality or privilege. If you = are not the intended recipient, please notify us immediately and destroy = the message without disclosing its contents to anyone. Any = distribution, use or copying of this e-mail or the information it = contains by other than an intended recipient is unauthorized. The views = and opinions expressed in this e-mail message are the author's own and = may not reflect the views and opinions of BGI, unless the author is = authorized by BGI to express such views or opinions on its behalf. All = email sent to or from this address is subject to electronic storage and = review by BGI. Although BGI operates anti-virus programs, it does not = accept responsibility for any damage whatsoever caused by viruses being = passed. |