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

More advanced filtering stacktrace lines

    XMLWordPrintable

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • None
    • None

    Description

      Currently, logback allows excluding some of the lines in the stacktraces from printing, which is useful for hiding stack frames coming from frameworks. E.g. 

      %rEx{full,
      java.lang.reflect.Method,
      {{ org.springframework,}}
      sun.reflect,
      net.sf.cglib,
      ByCGLIB
      }

      But sometimes a bit more advanced filtering would be useful. For example, we're using javalin web framework. In recent versions they refactored their code and now the stack trace from the framework contains lots of java.util.concurrent.CompletableFuture.xxx frames. 

      If I just filter out all CompletableFuture calls, i risk hiding them also from my own code that can use CompletableFuture. This would be very confusing. 

      So i think it would be nice to be able to configure a custom "stacktracefilter" implementation that would be smart and could contain mode adanced logic. For example, it would scan the frames until it finds the first line from the framework (io.javalin.Xxx in my case) and only then starts filtering the CompletableFuture lines.

      This could look like this:

      <configuration>
       <stackTraceFrameEvaluator name="MY_EVAL" class="my.stackTraceFrameEvaluator"/>
       <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> 
        <encoder>
         <pattern> %msg%rEx{MY_EVAL} </pattern>
        </encoder>
       </appender>
      </configuration>

       

       

      Attachments

        Activity

          People

            logback-dev Logback dev list
            grzegorzbor Grzegorz Borkowski
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: