http://www.perlmonks.org?node_id=1140873


in reply to Re^2: combine logentries with Log::log4perl
in thread combine logentries with Log::log4perl

You appear to be attempting to log to multiple places, hence all the double ups (and probably the cause of stuff not appearing on screen as expected). Try this:

use strict; use warnings; use Log::Log4perl qw(:easy); my $conf = <<EOT; log4perl.rootLogger = DEBUG, Log1 log4perl.appender.Log1 = Log::Log4perl::Appender::File log4perl.appender.Log1.filename = /tmp/test.log log4perl.appender.Log1.mode = append log4perl.appender.Log1.layout = Log::Log4perl::Layout::SimpleLayout log4perl.appender.Log1.Threshold = INFO log4perl.logger = TRACE, Log2 log4perl.appender.Log2 = Log::Log4perl::Appender::ScreenColoredLevels log4perl.appender.Log2.layout = Log::Log4perl::Layout::PatternLayout log4perl.appender.Log2.layout.ConversionPattern = %m%n log4perl.category = TRACE, Buffer log4perl.appender.Buffer = Log::Log4perl::Appender::Buffer log4perl.appender.Buffer.appender = Log1 log4perl.appender.Buffer.trigger_level = ERROR EOT Log::Log4perl->init(\$conf); TRACE("message #1 (screen only)"); INFO("message #2"); INFO("message #3"); sleep(10); ERROR("message #4");

EDIT: You've set the buffer to intercept all messages and only allow DEBUG and higher through. Thats why your onscreen TRACE message disappears. Still looking into the doubling up thing.

Oh, and I've updated my source - This gets the screen to display correctly, but everything is still doubled in the file.