2

I would like to add the Marker AUDIT and have it handled by a FileAppender:

<appender name="AUDIT_FILE" class="ch.qos.logback.core.FileAppender">
    <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
        <marker>AUDIT</marker>
    </evaluator>
    <file>${USER_HOME}/audit.log</file>
    <encoder>
        <pattern>%msg%n</pattern>
    </encoder>
</appender>

But it seems EventEvaluator only applies to SMTPAppender.

Basically, I would like to direct certain predefined log lines to a file - which it seems Marker is made for. Is there an alternative? Or a completely different way of solving the problem? It need not be with Logback, which is only used as it is the default in Spring Boot.

morsor
  • 1,263
  • 14
  • 29
  • 1
    see here: https://stackoverflow.com/a/14211884/1183729 basicaly, you need to wrap 'evaluator' tag into 'filter' and assign your appender to some 'root' tag. only took me couple of hours to find this out.. a needle in haystack really.. – greengold May 17 '18 at 15:14

0 Answers0