As you can see the object does not keep track of the appenders but still correctly writes output.erickn@cofjora01d:/home/erickn> cat logtest1 use strict; use warnings; use Log::Log4perl; use Data::Dumper; my $log_conf1 = <<EOT; log4perl.rootLogger=DEBUG, Screen log4perl.appender.Screen=Log::Log4perl::Appender::Screen log4perl.appender.Screen.stderr=0 log4perl.appender.Screen.layout=Log::Log4perl::Layout::PatternLayout log4perl.appender.Screen.layout.ConversionPattern = %d %-1.1p %P %H %m +%n EOT Log::Log4perl->init(\$log_conf1); my $log = Log::Log4perl->get_logger; print Dumper $log; $log->debug('this is a test'); erickn@cofjora01d:/home/erickn> perl logtest1 $VAR1 = bless( { 'is_OFF' => sub { "DUMMY" }, 'is_DEBUG' => sub { "DUMMY" }, 'ERROR' => sub { "DUMMY" }, 'is_INFO' => sub { "DUMMY" }, 'layout' => undef, 'category' => 'main', 'DEBUG' => $VAR1->{'ERROR'}, 'is_ALL' => sub { "DUMMY" }, 'additivity' => 1, 'ALL' => sub { "DUMMY" }, 'is_FATAL' => sub { "DUMMY" }, 'is_WARN' => sub { "DUMMY" }, 'FATAL' => $VAR1->{'ERROR'}, 'appender_names' => [], 'WARN' => $VAR1->{'ERROR'}, 'INFO' => $VAR1->{'ERROR'}, 'level' => undef, 'num_appenders' => 0, 'OFF' => $VAR1->{'ERROR'}, 'is_ERROR' => sub { "DUMMY" } }, 'Log::Log4perl::Logger' ); 2006/07/17 18:05:13 D 14011 cofjora01d this is a test
The appender is listed in the object and is available for removal or eradication.erickn@cofjora01d:/home/erickn> cat logtest2 use strict; use warnings; use Log::Log4perl; use Data::Dumper; my $screen = Log::Log4perl::Appender->new( "Log::Log4perl::Appender::Screen", name => "Screen", ); my $layout = Log::Log4perl::Layout::PatternLayout->new("%d %-1.1p %P % +H %m%n"); $screen->layout($layout); my $log = Log::Log4perl->get_logger; $log->add_appender($screen); print Dumper $log; $log->debug('this is another test'); erickn@cofjora01d:/home/erickn> perl logtest2 $VAR1 = bless( { 'is_OFF' => sub { "DUMMY" }, 'is_DEBUG' => sub { "DUMMY" }, 'ERROR' => sub { "DUMMY" }, 'is_INFO' => sub { "DUMMY" }, 'layout' => undef, 'category' => 'main', 'DEBUG' => $VAR1->{'ERROR'}, 'is_ALL' => sub { "DUMMY" }, 'additivity' => 1, 'ALL' => sub { "DUMMY" }, 'is_FATAL' => sub { "DUMMY" }, 'is_WARN' => sub { "DUMMY" }, 'FATAL' => $VAR1->{'ERROR'}, 'appender_names' => [ 'Screen' ], 'WARN' => $VAR1->{'ERROR'}, 'INFO' => $VAR1->{'ERROR'}, 'level' => undef, 'num_appenders' => 1, 'OFF' => $VAR1->{'ERROR'}, 'is_ERROR' => sub { "DUMMY" } }, 'Log::Log4perl::Logger' ); 2006/07/17 18:12:41 D 14290 cofjora01d this is another test
In reply to Re^3: How to turn off a Log4perl appender?
by mifflin
in thread How to turn off a Log4perl appender?
by mifflin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |