Details
-
Bug
-
Resolution: Duplicate
-
Major
-
1.2.6
-
None
Description
I encountered this bug with 1.2.6, however it's possible other versions are affected as well.
With a logback.xml configuration like this:
<configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>[%thread] %-5level - %msg%n%replace(%rootException{5 , sun.reflect , java.lang , java.util , org.gradle , com.sun , org.junit}){'\\n', '~~'}%nopexception</pattern> </encoder> </appender> <logger name="test" level="debug" additivity="false"> <appender-ref ref="STDOUT"/> </logger> <root level="error"> <appender-ref ref="STDOUT"/> </root> </configuration>
Logback throws a NullPointerException on startup:
10:52:50,790 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@11:19 - RuntimeException in Action for tag [encoder] java.lang.NullPointerException10:52:50,790 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@11:19 - RuntimeException in Action for tag [encoder] java.lang.NullPointerException at java.lang.NullPointerException at at ch.qos.logback.classic.pattern.ThrowableProxyConverter.start(ThrowableProxyConverter.java:75) at at ch.qos.logback.core.pattern.ConverterUtil.startConverters(ConverterUtil.java:37) at at ch.qos.logback.core.pattern.ConverterUtil.startConverters(ConverterUtil.java:33) at at ch.qos.logback.core.pattern.PatternLayoutBase.start(PatternLayoutBase.java:89) at at ch.qos.logback.classic.encoder.PatternLayoutEncoder.start(PatternLayoutEncoder.java:28)
I created this sample project to demonstrate the above error. I also took a stab at fixing the issue with this pull request.
Attachments
Issue Links
- duplicates
-
LOGBACK-1571 CompositeConverters do not have a context injected
- Resolved