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:


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.



Here is the WPParser source code, to give you an idea of how it is simple to write a parser:


package com.renault.loganalyser.parser;

import com.renault.loganalyser.util.DateToString;
import com.renault.loganalyser.config.ConfigManager;

public class WPParser implements ParserInterface {
  private static String version = "1.1";
  public static String todayDate = null;
  private boolean dateOK = false;

  public String processLine(String line) {
    //first check if date is ok (today)
    if(!dateOK) {
      if(line.indexOf(todayDate!= -1) {
        dateOK = true;
      else {
        return null;
    if(line.indexOf("Exception:"!= -1
    || line.indexOf("FWEN0069E"!= -1
    || line.indexOf("PortletException"!= -) {
      line = line.trim();
      return line;
    return null;

  static {
    todayDate = new DateToString("YYYY.MM.DD").getDate(0);

  public void initParser() {
    if(ConfigManager.getInstance().isParseOnlyToday()) {
      dateOK = false;
    else {
      dateOK = true;
  public String getVersion() {
    return version;