Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

log4perl long lines

by mguttman (Initiate)
on Mar 04, 2012 at 18:38 UTC ( #957804=perlquestion: print w/ replies, xml ) Need Help??
mguttman has asked for the wisdom of the Perl Monks concerning the following question:

Not liking the outcome of Log::Log4perl::Layout::PatternLayout::Multiline, I wonder how can I make log4perl format the log to look like the following:

18:21:58 Here starts a long logging line.... _________continuing here... _________and even here.... 18:22:06 Starting another one here...

(The underscores above are white space)

In other words, how do I specify the max line length and how do I skip past the %d{...} generated time stamp at the beginning of subsequent lines?

Well, while at that, can I specify TAB positions to create a table of sort?

Meir

Comment on log4perl long lines
Download Code
Re: log4perl long lines
by Perlbotics (Abbot) on Mar 04, 2012 at 20:06 UTC
Re: log4perl long lines
by ramlight (Friar) on Mar 05, 2012 at 16:53 UTC
    If you are willing to preformat your log lines (perhaps with a logging subroutine) you can define two loggers that log to the same file. One has the normal pattern layout, the other has blank space at the beginning of the conversion:
    # Untested but I have used similar code log4perl.appender.file1 = Log::Log4perl::Appender::File log4perl.appender.file1.filename = 'File.log' log4perl.appender.file1.mode = append log4perl.appender.file1.layout = Log::Log4perl::Layout::Patter +nLayout log4perl.appender.file1.layout.ConversionPattern = %d{E MMM dd yyy +y HH:mm:ss} - %m log4perl.appender.file1 = Log::Log4perl::Appender::File log4perl.appender.file1.filename = 'File.log' log4perl.appender.file1.mode = append log4perl.appender.file1.layout = Log::Log4perl::Layout::Patter +nLayout log4perl.appender.file2.layout.ConversionPattern = - + %m

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2014-10-25 11:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (142 votes), past polls