commit 9d3b269e41ebf6421ff89f59668966ea4014248c parent c232da44c400cbb6b9364c1cb5f2e25d16a63d50 Author: Wim Dupont <wim@wimdupont.com> Date: Fri, 22 Dec 2023 09:51:58 +0100 logback update Former-commit-id: 9ee79d586a49d36d24fa23282262e5bb3688fc55 Diffstat:
A | src/main/resources/logback-spring.xml | | | 36 | ++++++++++++++++++++++++++++++++++++ |
1 file changed, 36 insertions(+), 0 deletions(-)
diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml @@ -0,0 +1,36 @@ +<configuration> + + <property name="APP_LOG_ROOT" value="${user.home}/personalweb/log/"/> + <property name="LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1} - %m%n"/> + + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>${LOG_PATTERN}</pattern> + </encoder> + </appender> + <springProfile name="!dev"> + <appender name="logging" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${APP_LOG_ROOT}/personalweb.log</file> + <encoder> + <pattern>${LOG_PATTERN}</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${APP_LOG_ROOT}/personalweb-%i.log</fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>5MB</maxFileSize> + </triggeringPolicy> + </appender> + + <root level="INFO"> + <appender-ref ref="logging"/> + </root> + </springProfile> + <springProfile name="dev"> + <root level="INFO"> + <appender-ref ref="STDOUT"/> + </root> + </springProfile> +</configuration>