Parser Development
Will be updated soon...
JLog has an open plugin architecture, this means you can develop your own parser and benefit from all JLog functonnalities. The parser has one main work: JLog gives it a String from a log file, and the parser must say if that String must be counted and displayed in the result or ignored. If the String is not ignored, the parser can process it (for instance to remove a user id in a login failed message, remove a trailing date, ...) in order to sum up the same exception/message type.
To achive this, you must develop a Class that implements the interface:
com.renault.loganalyser.parser.ParserInterface
This interface declares 3 methods:
public String processLine(String line);
This method is the one described before. If the String must be in the analyse result return it or return it modified. If not, return null. If you look at the WASOutParser you will see how to modify the String to remove date at the beginning and some user id to have the good count of each message. If you do not such process, two same exception type with two different user id in the message core will not be intentified as the same exception.
public String getVersion();
This method returns the parser version, for instance "1.0".
public void initParser();
This method is called each time a new log file is parsed. You can do all your initialisation here. If you look at the WPParser class, you will find how to use this method to display only exception for a given date.
Note that you can access the JLog configuration using the singleton com.renault.loganalyser.config.ConfigManager class.
Sample
Here is the WPParser source code, to give you an idea of how it is simple to write a parser:
|