Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^4: How to turn off a Log4perl appender?

by saintmike (Vicar)
on Jul 19, 2006 at 18:18 UTC ( [id://562377]=note: print w/replies, xml ) Need Help??


in reply to Re^3: How to turn off a Log4perl appender?
in thread How to turn off a Log4perl appender?

Ignoring the internals for now, isn't the following exactly what you're looking for?
use strict; use warnings; use Log::Log4perl; my $log_conf1 = <<EOT; log4perl.rootLogger=DEBUG, Screen1, Screen2 log4perl.appender.Screen1=Log::Log4perl::Appender::Screen log4perl.appender.Screen1.stderr=0 log4perl.appender.Screen1.layout=Log::Log4perl::Layout::PatternLayout log4perl.appender.Screen1.layout.ConversionPattern = %d %-1.1p %P %H % +m %n log4perl.appender.Screen2=Log::Log4perl::Appender::Screen log4perl.appender.Screen2.stderr=0 log4perl.appender.Screen2.layout=Log::Log4perl::Layout::PatternLayout log4perl.appender.Screen2.layout.ConversionPattern = %d %-1.1p %P %H % +m %n EOT Log::Log4perl->init(\$log_conf1); Log::Log4perl->eradicate_appender("Screen1"); my $log = Log::Log4perl->get_logger; $log->debug('this is a test');

Replies are listed 'Best First'.
Re^5: How to turn off a Log4perl appender?
by mifflin (Curate) on Jul 20, 2006 at 00:16 UTC
    yep , that works.
    I had been trying the instance method remove_appender and was getting the error message...
    C:\home\erickn>test.pl No such appender: Screen1 at :/Perl/site/lib/Log/Log4perl/Logger.pm l +ine 604.
    Which lead me into the internals.
    The class method eradicate_appender seems to work perfect.
    I'm going to have to revisit the pod to see if I can figure out the difference between the two.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://562377]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (9)
As of 2024-04-18 14:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found