123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <configuration>
- <include resource="org/springframework/boot/logging/logback/base.xml"/>
- <logger name="jdbc.connection" additivity="false" level="FATAL">
- </logger>
- <logger name="jdbc.resultset" additivity="false" level="INFO">
- </logger>
- <logger name="jdbc.audit" additivity="false" level="INFO">
- </logger>
- <logger name="jdbc.sqlonly" additivity="false" level="DEBUG">
- </logger>
- <logger name="jdbc.sqltiming" additivity="false" level="info"><!--OFF -->
- <appender-ref ref="CONSOLE" />
- <appender-ref ref="FILE" />
- </logger>
- <!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
- <property name="LOG_HOME" value="/Users/gizmo/JavaProjectsFiles/Logs/cameron_wms" />
- <!--<appender name="consoleLog" class="ch.qos.logback.core.ConsoleAppender">-->
- <!--<layout class="ch.qos.logback.classic.PatternLayout">-->
- <!--<pattern>-->
- <!--%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n-->
- <!--</pattern>-->
- <!--</layout>-->
- <!--</appender>-->
- <appender name="fileInfoLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <file>${LOG_HOME}/warewms/log_info.log</file>
- <filter class="ch.qos.logback.classic.filter.LevelFilter">
- <level>ERROR</level>
- <onMatch>DENY</onMatch>
- <onMismatch>ACCEPT</onMismatch>
- </filter>
- <encoder>
- <pattern>
- %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
- </pattern>
- <charset>utf-8</charset>
- </encoder>
- <!--滚动策略-->
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <!-- 归档的日志文件的路径,例如今天是2013-12-21日志,当前写的日志文件路径为file节点指定,可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。
- 而2013-12-21的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
- <fileNamePattern> ${LOG_HOME}/warewms/info/log-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
- <maxHistory>30</maxHistory>
- <totalSizeCap>2GB</totalSizeCap>
- <!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始,
- 命名日志文件,例如log-error-2013-12-21.0.log -->
- <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
- <maxFileSize>2MB</maxFileSize>
- </timeBasedFileNamingAndTriggeringPolicy>
- </rollingPolicy>
- </appender>
- <appender name="fileErrorLog" class="ch.qos.logback.core.rolling.RollingFileAppender">
- <!-- 正在记录的日志文件的路径及文件名 -->
- <file>${LOG_HOME}/warewms/log_error.log</file>
- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
- <level>ERROR</level>
- </filter>
- <encoder>
- <pattern>
- %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
- </pattern>
- <charset>utf-8</charset>
- </encoder>
- <!--滚动策略-->
- <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
- <!-- 归档的日志文件的路径,例如今天是2013-12-21日志,当前写的日志文件路径为file节点指定,可以将此文件与file指定文件路径设置为不同路径,从而将当前日志文件或归档日志文件置不同的目录。
- 而2013-12-21的日志文件在由fileNamePattern指定。%d{yyyy-MM-dd}指定日期格式,%i指定索引 -->
- <fileNamePattern> ${LOG_HOME}/warewms/error/log-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
- <maxHistory>30</maxHistory>
- <totalSizeCap>1GB</totalSizeCap>
- <!-- 除按日志记录之外,还配置了日志文件不能超过2M,若超过2M,日志文件会以索引0开始,
- 命名日志文件,例如log-error-2013-12-21.0.log -->
- <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
- <maxFileSize>2MB</maxFileSize>
- </timeBasedFileNamingAndTriggeringPolicy>
- </rollingPolicy>
- <!-- 追加方式记录日志 -->
- <append>true</append>
- </appender>
- <springProfile name="dev">
- <root level="info">
- <!--<appender-ref ref="consoleLog" />-->
- <appender-ref ref="fileInfoLog" />
- <appender-ref ref="fileErrorLog" />
- </root>
- </springProfile>
- <springProfile name="test">
- <root level="info">
- <!--<appender-ref ref="consoleLog" />-->
- <appender-ref ref="fileInfoLog" />
- <appender-ref ref="fileErrorLog" />
- </root>
- </springProfile>
- <springProfile name="prod">
- <root level="info">
- <appender-ref ref="fileInfoLog" />
- <appender-ref ref="fileErrorLog" />
- </root>
- </springProfile>
- </configuration>
|