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