Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: combine logentries with Log::log4perl

by SimonPratt (Friar)
on Sep 03, 2015 at 13:30 UTC ( #1140879=note: print w/replies, xml ) Need Help??


in reply to combine logentries with Log::log4perl

Here:

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

In my play around, I found that buffering only reliably works when buffering to screen (which makes sense, given that switching off autoflush effectively buffers file output).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (3)
As of 2019-10-20 04:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?