@Test
  public void testCustomLevel() throws IOException, InitializationException {
    Properties p = new Properties();
    // Mixing sequence on purpose to test that sequence does not matter.
    p.put("MESSAGE.group", "4");
    p.put("LEVEL.group", "2");
    p.put("TIMESTAMP.group", "1");
    p.put("THREAD.group", "3");
    p.put("type", "log4j");
    p.put("rePattern", "(\\S+ \\S+) +(\\S+) +\\[\\s*(\\S+)\\s*\\] +(.*)");
    p.put("dateFormat", "yyyy-MM-dd HH:mm:ss,SSS");
    p.put("customLevels", "L1=TRACE,L2=DEBUG,L3=INFO,L4=WARN,L5=ERROR");
    Log4jPatternMultilineLogParser logParser = new Log4jPatternMultilineLogParser();
    InputStream in = loadLog("log4j/log4j_cusom_level.txt");
    LogImporterUsingParser importerUsingParser = new LogImporterUsingParser(logParser);
    ParsingContext context = new ParsingContext("?", "log4j/log4j_cusom_level.txt");
    importerUsingParser.init(p);
    importerUsingParser.initParsingContext(context);

    // when
    ProxyLogDataCollector dataCollector = new ProxyLogDataCollector();
    importerUsingParser.importLogs(in, dataCollector, context);

    // then
    LogData[] logDatas = dataCollector.getLogData();
    assertEquals(10, logDatas.length);
    assertEquals(Level.FINEST, logDatas[0].getLevel());
    assertEquals(Level.FINE, logDatas[1].getLevel());
    assertEquals(Level.INFO, logDatas[2].getLevel());
    assertEquals(Level.WARNING, logDatas[3].getLevel());
    assertEquals(Level.SEVERE, logDatas[4].getLevel());
    assertEquals(Level.FINEST, logDatas[5].getLevel());
    assertEquals(Level.FINE, logDatas[6].getLevel());
    assertEquals(Level.INFO, logDatas[7].getLevel());
    assertEquals(Level.WARNING, logDatas[8].getLevel());
    assertEquals(Level.SEVERE, logDatas[9].getLevel());

    for (int i = 0; i < logDatas.length; i++) {
      assertEquals(String.format("LogData source for event %d of %d", i, logDatas.length), context.getLogSource(), logDatas[i].getLogSource());
    }

  }
This class tests the "rePattern" alternative of Log4jPatternMultilineLogParser.
(As opposed to the more simple "pattern" system).
olv-core/src/test/java/pl/otros/logview/parser/log4j/Log4jPatternRegexParserTest.java