in reply to Indenting, multi-line Log4perl Layout class?

Your logfile output seems to indicate that what you really want is to split up a message that contains N newlines into N+1 separate messages (note the duplicate timestamps). That could be confusing, so I don't think Log4perl would want to support that.

If you just want to replace newlines by newline+indentation, as you've mentioned, you could use the appender in the FAQ.

To use this appender in conjunction with other appenders, you can define it as a 'composite' appender, Log::Log4perl::Appender::Buffer shows an example.

I could also envision a wrapper class around Log4perl that breaks up long messages before handing them over to Log4perl.

And on the layout level, maybe a custom cspec with some additional magic could do the trick.

Or, try to convince the guys on the log4perl-devel@ mailing list to add a layout element to the PatternLayout that does line breaking. Seems like a useful feature.

  • Comment on Re: Indenting, multi-line Log4perl Layout class?