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.