Search code examples
fileparsinglog4jlogging

Parse a log4j log file


We have several applications that use log4j for logging. I need to get a log4j parser working so we can combine multiple log files and run automated analysis on them. I'm not looking to reinvent the wheel, so can someone point me to a decent pre-existing parser? I do have the log4j conversion pattern if that helps.

If not, I'll have to roll our own.


Solution

  • I didn't realize that Log4J ships with an XML appender.

    Solution was: specify an XML appender in the logging configuration file, include that output XML file as an entity into a well formed XML file, then parse the XML using your favorite technique.

    The other methods had the following limitations:

    • Apache Chainsaw - not automated enough
    • jdbc - poor performance in a high performance distributed app