fix logback config

fix logback config (cf. https://logback.qos.ch/codes.html#nested_if_element)
This commit is contained in:
Adrian-Devries
2024-12-19 15:40:55 +01:00
committed by GitHub
parent e6ffd658f6
commit 5b386b6af1

View File

@@ -1,33 +1,37 @@
<configuration> <configuration>
<appender name="STDERR"
<appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender"> class="ch.qos.logback.core.ConsoleAppender">
<target>System.err</target> <target>System.err</target>
<encoder> <encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder> </encoder>
</appender> </appender>
<if condition='property("FILE_APPENDER_ENABLED").contains("true")'>
<if condition='property("FILE_APPENDER_ENABLED").contains("true")'> <then>
<then> <appender name="FILE"
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> class="ch.qos.logback.core.rolling.RollingFileAppender">
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- Daily rollover --> <!-- Daily rollover -->
<fileNamePattern>log/ZUV-%d{yyyy-MM}.log</fileNamePattern> <fileNamePattern>log/ZUV-%d{yyyy-MM}.log</fileNamePattern>
<!-- Keep 5 years worth of history -->
<!-- Keep 5 years worth of history --> <maxHistory>60</maxHistory>
<maxHistory>60</maxHistory> </rollingPolicy>
</rollingPolicy> <encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
<encoder> </encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> </appender>
</encoder> </then>
</appender> </if>
</then> <!-- Configure so that it outputs to both console and log file -->
</if> <if condition='property("FILE_APPENDER_ENABLED").contains("true")'>
<then>
<!-- Configure so that it outputs to both console and log file --> <root level="INFO">
<root level="INFO"> <appender-ref ref="FILE"/>
<appender-ref ref="FILE"/> </root>
<appender-ref ref="STDERR"/> </then>
</root> </if>
</configuration> <root level="INFO">
<appender-ref ref="STDERR"/>
</root>
</configuration>