Search in sources :

Example 1 with MessageFactory2Adapter

use of org.apache.logging.log4j.spi.MessageFactory2Adapter in project logging-log4j2 by apache.

the class LoggerTest method checkMessageFactory.

private static void checkMessageFactory(final MessageFactory messageFactory1, final Logger testLogger1) {
    if (messageFactory1 == null) {
        assertEquals(AbstractLogger.DEFAULT_MESSAGE_FACTORY_CLASS, testLogger1.getMessageFactory().getClass());
    } else {
        MessageFactory actual = testLogger1.getMessageFactory();
        if (actual instanceof MessageFactory2Adapter) {
            actual = ((MessageFactory2Adapter) actual).getOriginal();
        }
        assertEquals(messageFactory1, actual);
    }
}
Also used : MessageFactory2Adapter(org.apache.logging.log4j.spi.MessageFactory2Adapter) ParameterizedMessageFactory(org.apache.logging.log4j.message.ParameterizedMessageFactory) MessageFactory(org.apache.logging.log4j.message.MessageFactory) StringFormatterMessageFactory(org.apache.logging.log4j.message.StringFormatterMessageFactory)

Example 2 with MessageFactory2Adapter

use of org.apache.logging.log4j.spi.MessageFactory2Adapter in project logging-log4j2 by apache.

the class LoggerTest method assertEqualMessageFactory.

private void assertEqualMessageFactory(final MessageFactory messageFactory, final TestLogger testLogger) {
    MessageFactory actual = testLogger.getMessageFactory();
    if (actual instanceof MessageFactory2Adapter) {
        actual = ((MessageFactory2Adapter) actual).getOriginal();
    }
    assertEquals(messageFactory, actual);
}
Also used : MessageFactory2Adapter(org.apache.logging.log4j.spi.MessageFactory2Adapter) MessageFactory(org.apache.logging.log4j.message.MessageFactory) ParameterizedMessageFactory(org.apache.logging.log4j.message.ParameterizedMessageFactory) SimpleMessageFactory(org.apache.logging.log4j.message.SimpleMessageFactory) StringFormatterMessageFactory(org.apache.logging.log4j.message.StringFormatterMessageFactory)

Example 3 with MessageFactory2Adapter

use of org.apache.logging.log4j.spi.MessageFactory2Adapter in project logging-log4j2 by apache.

the class LoggerTest method checkMessageFactory.

private static void checkMessageFactory(final MessageFactory messageFactory1, final Logger testLogger1) {
    if (messageFactory1 == null) {
        assertEquals(AbstractLogger.DEFAULT_MESSAGE_FACTORY_CLASS, testLogger1.getMessageFactory().getClass());
    } else {
        MessageFactory actual = testLogger1.getMessageFactory();
        if (actual instanceof MessageFactory2Adapter) {
            actual = ((MessageFactory2Adapter) actual).getOriginal();
        }
        assertEquals(messageFactory1, actual);
    }
}
Also used : MessageFactory2Adapter(org.apache.logging.log4j.spi.MessageFactory2Adapter) MessageFactory(org.apache.logging.log4j.message.MessageFactory) ParameterizedMessageFactory(org.apache.logging.log4j.message.ParameterizedMessageFactory) StringFormatterMessageFactory(org.apache.logging.log4j.message.StringFormatterMessageFactory)

Example 4 with MessageFactory2Adapter

use of org.apache.logging.log4j.spi.MessageFactory2Adapter in project logging-log4j2 by apache.

the class SetLoggerTagTest method checkMessageFactory.

private static void checkMessageFactory(final String msg, final MessageFactory messageFactory1, final Logger testLogger1) {
    if (messageFactory1 == null) {
        assertEquals(msg, AbstractLogger.DEFAULT_MESSAGE_FACTORY_CLASS, testLogger1.getMessageFactory().getClass());
    } else {
        MessageFactory actual = testLogger1.getMessageFactory();
        if (actual instanceof MessageFactory2Adapter) {
            actual = ((MessageFactory2Adapter) actual).getOriginal();
        }
        assertEquals(msg, messageFactory1, actual);
    }
}
Also used : MessageFactory2Adapter(org.apache.logging.log4j.spi.MessageFactory2Adapter) MessageFactory(org.apache.logging.log4j.message.MessageFactory) StringFormatterMessageFactory(org.apache.logging.log4j.message.StringFormatterMessageFactory)

Aggregations

MessageFactory (org.apache.logging.log4j.message.MessageFactory)4 StringFormatterMessageFactory (org.apache.logging.log4j.message.StringFormatterMessageFactory)4 MessageFactory2Adapter (org.apache.logging.log4j.spi.MessageFactory2Adapter)4 ParameterizedMessageFactory (org.apache.logging.log4j.message.ParameterizedMessageFactory)3 SimpleMessageFactory (org.apache.logging.log4j.message.SimpleMessageFactory)1