Search in sources :

Example 1 with AsyncLogProvider

use of org.neo4j.logging.async.AsyncLogProvider in project neo4j by neo4j.

the class AsyncLoggingTest method shouldLogWhenLoggingThreadStarts.

@Test
public void shouldLogWhenLoggingThreadStarts() throws Exception {
    // given
    AssertableLogProvider logs = new AssertableLogProvider();
    AsyncLogging logging = new AsyncLogging(logs.getLog("meta"));
    // when
    new AsyncLogProvider(logging.eventSender(), logs).getLog("test").info("hello");
    // then
    logs.assertNoLoggingOccurred();
    // when
    logging.start();
    logging.stop();
    // then
    logs.assertExactly(inLog("test").info(endsWith("hello")));
}
Also used : AsyncLogProvider(org.neo4j.logging.async.AsyncLogProvider) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) Test(org.junit.Test)

Example 2 with AsyncLogProvider

use of org.neo4j.logging.async.AsyncLogProvider in project neo4j by neo4j.

the class AsyncLoggingTest method shouldLogMessages.

@Test
public void shouldLogMessages() throws Exception {
    // given
    AssertableLogProvider logs = new AssertableLogProvider();
    AsyncLogging logging = new AsyncLogging(logs.getLog("meta"));
    // when
    logging.start();
    try {
        new AsyncLogProvider(logging.eventSender(), logs).getLog("test").info("hello");
    } finally {
        logging.stop();
    }
    // then
    logs.assertExactly(inLog("test").info(endsWith("hello")));
}
Also used : AsyncLogProvider(org.neo4j.logging.async.AsyncLogProvider) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 AssertableLogProvider (org.neo4j.logging.AssertableLogProvider)2 AsyncLogProvider (org.neo4j.logging.async.AsyncLogProvider)2