commit 9fc550d3a23092f3e641e1a3ee639ba6940d4a33 parent 8e0243ae6e30c4c483ca240bc65136d6695fcb74 Author: Wim Dupont <wim@wimdupont.com> Date: Fri, 22 Dec 2023 09:48:47 +0100 logback update Diffstat:
A | src/main/resources/logback-spring.xml | | | 55 | +++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
D | src/main/resources/logback.xml | | | 35 | ----------------------------------- |
2 files changed, 55 insertions(+), 35 deletions(-)
diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml @@ -0,0 +1,55 @@ +<configuration> + + <property name="APP_LOG_ROOT" value="${user.home}/sxcybot/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="prod"> + <appender name="monitor" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${APP_LOG_ROOT}/monitor/monitor.log</file> + <encoder> + <pattern>${LOG_PATTERN}</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${APP_LOG_ROOT}/monitor-%i.log</fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>5MB</maxFileSize> + </triggeringPolicy> + </appender> + + <appender name="logging" class="ch.qos.logback.core.rolling.RollingFileAppender"> + <file>${APP_LOG_ROOT}/sxcybot.log</file> + <encoder> + <pattern>${LOG_PATTERN}</pattern> + </encoder> + <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> + <fileNamePattern>${APP_LOG_ROOT}/sxcybot-%i.log</fileNamePattern> + <minIndex>1</minIndex> + <maxIndex>10</maxIndex> + </rollingPolicy> + <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> + <maxFileSize>5MB</maxFileSize> + </triggeringPolicy> + </appender> + + <logger name="monitor" level="INFO"> + <appender-ref ref="monitor"/> + </logger> + + <root level="INFO"> + <appender-ref ref="logging"/> + </root> + </springProfile> + <springProfile name="!prod"> + <root level="INFO"> + <appender-ref ref="STDOUT"/> + </root> + </springProfile> +</configuration> diff --git a/src/main/resources/logback.xml b/src/main/resources/logback.xml @@ -1,35 +0,0 @@ -<configuration> - - <property name="APP_LOG_ROOT" value="${user.home}/sxcybot/monitor/"/> - <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> - - <appender name="monitor" class="ch.qos.logback.core.rolling.RollingFileAppender"> - <file>${APP_LOG_ROOT}/monitor.log</file> - <encoder> - <pattern>${LOG_PATTERN}</pattern> - </encoder> - <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> - <fileNamePattern>${APP_LOG_ROOT}/monitor-%i.log</fileNamePattern> - <minIndex>1</minIndex> - <maxIndex>10</maxIndex> - </rollingPolicy> - <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> - <maxFileSize>10MB</maxFileSize> - </triggeringPolicy> - </appender> - - <logger name="monitor" level="INFO"> - <appender-ref ref="monitor"/> - </logger> - - <root level="INFO"> - <appender-ref ref="STDOUT"/> - </root> - -</configuration>