Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Invalid
-
2.2
-
None
-
None
-
Netbeans 8.0.2
Description
This configuration
<?xml version="1.0" encoding="UTF-8"?> <Configuration> <Appenders> <Console name="Console" target="SYSTEM_OUT"> <PatternLayout pattern="[%level] %message%exception{short}%n"/> </Console> </Appenders> <Loggers> <Root level="trace"> <AppenderRef ref="Console"/> </Root> </Loggers> </Configuration>
And this unit test:
Log4j2Test.java
import org.apache.logging.log4j.LogManager; import org.junit.Test; public class Log4j2Test { @Test public void testLogging() { LogManager.getLogger().info("expecting [INFO]", new RuntimeException()); } }
Result in the following:
expecting [INFO] java.lang.RuntimeException at Log4j2Test.testLogging(Log4j2Test.java:19)
I would expect:
[INFO] expecting [INFO] java.lang.RuntimeException at Log4j2Test.testLogging(Log4j2Test.java:19)
I found this issue in 2.1 and I reproduced it in 2.2.
Note: similar patterns like the following work as expected.
[%-5level] %message%exception{short}%n %level %message%exception{short}%n