Java Code Examples for org.apache.logging.log4j.message.ParameterizedMessageFactory#INSTANCE

The following examples show how to use org.apache.logging.log4j.message.ParameterizedMessageFactory#INSTANCE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LoggerTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
@Test
public void getLogger_Class_ParameterizedMessageFactory() {
    // The TestLogger logger was already created in an instance variable for this class.
    // The message factory is only used when the logger is created.
    final ParameterizedMessageFactory messageFactory = ParameterizedMessageFactory.INSTANCE;
    final TestLogger testLogger = (TestLogger) LogManager.getLogger(TestParameterizedMessageFactory.class,
            messageFactory);
    assertNotNull(testLogger);
    assertEqualMessageFactory(messageFactory, testLogger);
    testLogger.debug("{}", Integer.MAX_VALUE);
    assertEquals(1, testLogger.getEntries().size());
    assertEquals(" DEBUG " + Integer.MAX_VALUE, testLogger.getEntries().get(0));
}
 
Example 2
Source File: LoggerTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
@Test
public void getLogger_Object_ParameterizedMessageFactory() {
    // The TestLogger logger was already created in an instance variable for this class.
    // The message factory is only used when the logger is created.
    final ParameterizedMessageFactory messageFactory =  ParameterizedMessageFactory.INSTANCE;
    final TestLogger testLogger = (TestLogger) LogManager.getLogger(new TestParameterizedMessageFactory(),
            messageFactory);
    assertNotNull(testLogger);
    assertEqualMessageFactory(messageFactory, testLogger);
    testLogger.debug("{}", Integer.MAX_VALUE);
    assertEquals(1, testLogger.getEntries().size());
    assertEquals(" DEBUG " + Integer.MAX_VALUE, testLogger.getEntries().get(0));
}
 
Example 3
Source File: LoggerTest.java    From logging-log4j2 with Apache License 2.0 5 votes vote down vote up
@Test
public void getLogger_String_ParameterizedMessageFactory() {
    final ParameterizedMessageFactory messageFactory =  ParameterizedMessageFactory.INSTANCE;
    final TestLogger testLogger = (TestLogger) LogManager.getLogger("getLogger_String_ParameterizedMessageFactory",
            messageFactory);
    assertNotNull(testLogger);
    assertEqualMessageFactory(messageFactory, testLogger);
    testLogger.debug("{}", Integer.MAX_VALUE);
    assertEquals(1, testLogger.getEntries().size());
    assertEquals(" DEBUG " + Integer.MAX_VALUE, testLogger.getEntries().get(0));
}
 
Example 4
Source File: AbstractLoggerTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
CountingLogger() {
    super("CountingLogger", ParameterizedMessageFactory.INSTANCE);
}
 
Example 5
Source File: AbstractLoggerTest.java    From logging-log4j2 with Apache License 2.0 4 votes vote down vote up
ThrowableExpectingLogger(final boolean expectingThrowables) {
    super("ThrowableExpectingLogger", ParameterizedMessageFactory.INSTANCE);
    this.expectingThrowables = expectingThrowables;
}