Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


You can create a log that captures all warnings, errors, etc. from the main process log, but excludes certain "common" warnings. The techniques shown can be adapted to filter messages out of the other logs, if so desired. The example also limits the size of the stack traces from Java exceptions.

Code Block
    <!-- Add an appender below the existing ones. -->
    <appender name="IDP_WARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <!-- Example of filtering out messages by searching the log message. -->
        <filter class="ch.qos.logback.core.filter.EvaluatorFilter">      
                <expression>event.getMessage().indexOf("trying its failover connector") >= 0</expression>
        <!-- Suppress anything above below WARN. -->
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <Pattern>%date{HH:mm:ss.SSS} - %level [%logger:%line] - %msg%n%ex{3}</Pattern>

    <!-- Modify root logging category at end of file and add new appender. -->
    <root level="ERROR">
        <appender-ref ref="IDP_PROCESS" />
        <appender-ref ref="IDP_WARN" />