How can I make log4perl output easier to read?

When using log4perl, the debug log layout that I'm using is :

log4perl.appender.D10.layout.ConversionPattern=%d [pid=%P] %p %F{1} (%L) %M %m%n
log4perl.appender.D10.Filter = DebugAndUp

This produces very verbose debug logs, for example:

2008/11/26 11:57:28 [pid=25485] DEBUG (331) functions::SomeModule::Test Test XXX was successfull
2008/11/26 11:57:29 [pid=25485] ERROR (99999) functions::SomeModule::AnotherTest AnotherTest YYY has faled

This works great, and provides excellent debugging data.

However, each line of the debug log contains different function names, pid length, etc. This makes each line layout differently, and makes reading debug logs much harder than it needs to be.

Is there a way in log4perl to format the line so that the debugging metadata (everything up until the actual log message) be padded at the end with spaces/tabs, and have the actual message start at the same column of text?


You can pad the single fields that make up your entries. For example [pid=%5P] will always give you at least 5 characters for the PID.

The "Quantify Placeholders" section in the docs for Log::Log4perl::Layout gives more details.

Need Your Help

F# language - hints for newbie


Looks like here in StackOveflow there is a group of F# enthusiasts.

Authenticity_token in Rails + Android

android ruby-on-rails authenticity-token

I am developing an Android application that communicates with a rails server. I don't want to ignore the authenticity_token but I also don't think asking for it is the right answer. What can be don...