@Test
public void testLog() throws Exception {

    final SessionID sessionID = new SessionID("FIX.4.2", "SENDER" + System.currentTimeMillis(),
            "TARGET" + System.currentTimeMillis());
    final long systemTime = SystemTime.currentTimeMillis();
    SystemTime.setTimeSource(new MockSystemTimeSource(systemTime));
    final SessionSettings settings = new SessionSettings();
    final SLF4JLogFactory factory = new SLF4JLogFactory(settings);
    Log log = factory.create(sessionID);
    final String loggedText = "TEST123";
    setUpLoggerForTest(SLF4JLog.DEFAULT_EVENT_CATEGORY);
    log.onEvent(loggedText);
    assertMessageLogged(SLF4JLog.DEFAULT_EVENT_CATEGORY, sessionID, loggedText);
    setUpLoggerForTest(SLF4JLog.DEFAULT_ERROR_EVENT_CATEGORY);
    log.onErrorEvent(loggedText);
    assertMessageLogged(SLF4JLog.DEFAULT_ERROR_EVENT_CATEGORY, sessionID, loggedText);
    setUpLoggerForTest(SLF4JLog.DEFAULT_INCOMING_MSG_CATEGORY);
    log.onIncoming(loggedText);
    assertMessageLogged(SLF4JLog.DEFAULT_INCOMING_MSG_CATEGORY, sessionID, loggedText);
    setUpLoggerForTest(SLF4JLog.DEFAULT_OUTGOING_MSG_CATEGORY);
    log.onOutgoing(loggedText);
    assertMessageLogged(SLF4JLog.DEFAULT_OUTGOING_MSG_CATEGORY, sessionID, loggedText);
    settings.setString(sessionID, SLF4JLogFactory.SETTING_EVENT_CATEGORY, "event");
    settings.setString(sessionID, SLF4JLogFactory.SETTING_ERROR_EVENT_CATEGORY, "errorEvent");
    settings.setString(sessionID, SLF4JLogFactory.SETTING_INMSG_CATEGORY, "in");
    settings.setString(sessionID, SLF4JLogFactory.SETTING_OUTMSG_CATEGORY, "out");
    log = factory.create(sessionID);
    setUpLoggerForTest("event");
    log.onEvent(loggedText);
    assertMessageLogged("event", sessionID, loggedText);
    setUpLoggerForTest("errorEvent");
    log.onErrorEvent(loggedText);
    assertMessageLogged("errorEvent", sessionID, loggedText);
    setUpLoggerForTest("in");
    log.onIncoming(loggedText);
    assertMessageLogged("in", sessionID, loggedText);
    setUpLoggerForTest("out");
    log.onOutgoing(loggedText);
    assertMessageLogged("out", sessionID, loggedText);
}