Search in sources :

Example 1 with LocalizedMessage

use of org.apache.logging.log4j.message.LocalizedMessage in project logging-log4j2 by apache.

the class LoggerSupplierTest method flowTracing_SupplierOfLocalizedMessage.

@Test
public void flowTracing_SupplierOfLocalizedMessage() {
    logger.traceEntry(new Supplier<LocalizedMessage>() {

        @Override
        public LocalizedMessage get() {
            return new LocalizedMessage("int foo={}", 1234567890);
        }
    });
    assertEquals(1, results.size());
    assertThat("Incorrect Entry", results.get(0), startsWith("ENTER[ FLOW ] TRACE Enter"));
    assertThat("Missing entry data", results.get(0), containsString("(int foo=1234567890)"));
    assertThat("Bad toString()", results.get(0), not(containsString("LocalizedMessage")));
}
Also used : LocalizedMessage(org.apache.logging.log4j.message.LocalizedMessage) Test(org.junit.Test)

Example 2 with LocalizedMessage

use of org.apache.logging.log4j.message.LocalizedMessage in project logging-log4j2 by apache.

the class Category method l7dlog.

public void l7dlog(final Priority priority, final String key, final Throwable t) {
    if (isEnabledFor(priority)) {
        final Message msg = new LocalizedMessage(bundle, key, null);
        forcedLog(FQCN, priority, msg, t);
    }
}
Also used : ObjectMessage(org.apache.logging.log4j.message.ObjectMessage) Message(org.apache.logging.log4j.message.Message) LocalizedMessage(org.apache.logging.log4j.message.LocalizedMessage) LocalizedMessage(org.apache.logging.log4j.message.LocalizedMessage)

Example 3 with LocalizedMessage

use of org.apache.logging.log4j.message.LocalizedMessage in project logging-log4j2 by apache.

the class Category method l7dlog.

public void l7dlog(final Priority priority, final String key, final Object[] params, final Throwable t) {
    if (isEnabledFor(priority)) {
        final Message msg = new LocalizedMessage(bundle, key, params);
        forcedLog(FQCN, priority, msg, t);
    }
}
Also used : ObjectMessage(org.apache.logging.log4j.message.ObjectMessage) Message(org.apache.logging.log4j.message.Message) LocalizedMessage(org.apache.logging.log4j.message.LocalizedMessage) LocalizedMessage(org.apache.logging.log4j.message.LocalizedMessage)

Aggregations

LocalizedMessage (org.apache.logging.log4j.message.LocalizedMessage)3 Message (org.apache.logging.log4j.message.Message)2 ObjectMessage (org.apache.logging.log4j.message.ObjectMessage)2 Test (org.junit.Test)1