Uploaded image for project: 'logback'
  1. logback
  2. LOGBACK-990

NPE when coloring stack trace sub-pattern with evaluator

    XMLWordPrintable

Details

    Description

      Such configuration

      <configuration>
          <evaluator name="HIDE_EX_EVAL">
              <expression>throwable instanceof com.acme.MyException</expression>
          </evaluator>
      
          <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
              <encoder>
                  <pattern>[%thread] %highlight(%-5level) %cyan(%logger{15}) - %msg %n%red(%rEx{full, HIDE_EX_EVAL})</pattern>
              </encoder>
          </appender>
          ...
      </configuration>
      

      leads to NullPointerException

      00:32:38,188 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
      00:32:38,191 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
      00:32:38,212 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
      00:32:38,250 |-ERROR in ch.qos.logback.core.joran.spi.Interpreter@12:19 - RuntimeException in Action for tag [encoder] java.lang.NullPointerException
      	at java.lang.NullPointerException
      	at ch.qos.logback.classic.pattern.ThrowableProxyConverter.start(ThrowableProxyConverter.java:74)
      	at ch.qos.logback.core.pattern.ConverterUtil.startConverters(ConverterUtil.java:37)
      	at ch.qos.logback.core.pattern.ConverterUtil.startConverters(ConverterUtil.java:33)
      	at ch.qos.logback.core.pattern.PatternLayoutBase.start(PatternLayoutBase.java:91)
      	at ch.qos.logback.classic.encoder.PatternLayoutEncoder.start(PatternLayoutEncoder.java:28)
      	at ch.qos.logback.core.joran.action.NestedComplexPropertyIA.end(NestedComplexPropertyIA.java:167)
      	at ch.qos.logback.core.joran.spi.Interpreter.callEndAction(Interpreter.java:317)
      	at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:196)
      	at ch.qos.logback.core.joran.spi.Interpreter.endElement(Interpreter.java:182)
      	at ch.qos.logback.core.joran.spi.EventPlayer.play(EventPlayer.java:62)
      	...
      

      Attachments

        Activity

          People

            ceki Ceki Gülcü
            eugenef Eugene Fedotov
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: