@Test
  public void testLevelWithSpaces() 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("CLASS.group", "3");
    p.put("rePattern", "(\\S+ \\S+)\\|(\\S+) *\\|\\s*(\\S+)\\s*\\| *(.*)");
    p.put("type", "log4j");
    p.put("dateFormat", "yyyy.MM.dd HH:mm:ss.SSS");
    Log4jPatternMultilineLogParser logParser = new Log4jPatternMultilineLogParser();
    InputStream in = loadLog("log4j/log4j_pattern_level_with_spaces.log");
    LogImporterUsingParser importerUsingParser = new LogImporterUsingParser(logParser);
    ParsingContext context = new ParsingContext();
    importerUsingParser.init(p);
    importerUsingParser.initParsingContext(context);

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

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

  }
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