Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

log4perl long lines

by mguttman (Novice)
on Mar 04, 2012 at 18:38 UTC ( [id://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

Replies are listed 'Best First'.
Re: log4perl long lines
by Perlbotics (Archbishop) 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
Domain Nodelet?
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?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-03-29 07:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found