How to create bookmark in logback?

Asked

Viewed 87 times

2

I am trying to create a bookmark inside my logback appender and could not. My code is

  <appender name="ErrorFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <!-- Support multiple-JVM writing to the same log file -->
    <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
        <marker>NOTIFY_ERROR</marker>
    </evaluator>
    <prudent>true</prudent>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
        <fileNamePattern>mensageiroErro.%d{yyyy-MM-dd}.log</fileNamePattern>
        <maxHistory>30</maxHistory> 
    </rollingPolicy>

    <encoder>
        <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} ${LOG_LEVEL_PATTERN:-%5p} ${PID:- } - [%t] %-40.40logger{39} : [%X{MDC_TOKEN}%X{camel.breadcrumbId}] %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern>
    </encoder>
</appender> 

When climbing the application gives the following error:

java.lang.IllegalStateException: Logback configuration error detected: 
ERROR in ch.qos.logback.core.joran.spi.Interpreter@21:76 - no applicable action for [evaluator], current ElementPath  is [[configuration][appender][evaluator]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@22:21 - no applicable action for [marker], current ElementPath  is [[configuration][appender][evaluator][marker]]

It’s probably because it’s in the wrong place. But I did according to the logback appenders documentation:

http://logback.qos.ch/manual/appenders.html

Does anyone know how to solve?

1 answer

1

The problem is that your appender does not support notifications.

See that in the example, he uses ch.qos.logback.classic.net.SMTPAppender, that has special implementations to send a notification message.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.