Parse a log4j log file

后端 未结 5 1110
温柔的废话
温柔的废话 2020-12-03 15:50

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 n

5条回答
  •  庸人自扰
    2020-12-03 16:40

    You can use OtrosLogViewer with batch processing. You have to:

    1. Define you log format, you can use Log4j pattern layout parser or Log4j XmlLayout
    2. Create java class that implements LogDataParsedListener. Method public void logDataParsed(LogData data, BatchProcessingContext context) will be called on every parsed log event.
    3. Create jar
    4. Run OtrosLogViewer with specifying your log processing jar, LogDataParsedListener implementation and log files.

提交回复
热议问题