|
|
|
@ -1,93 +1,147 @@
|
|
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
|
|
<configuration>
|
|
|
|
|
|
|
|
|
|
<!--根节点 , logback的全局配置 , 包含3个属性
|
|
|
|
|
scan : 当文件发生变更时是否重载 , 默认值ture
|
|
|
|
|
scanPeriod : 监测文件的间隔时间 , 即每隔多少时间扫描一次配置文件 仅当scan=true时生效. 默认间隔时间1min , 如果不写单位默认是毫秒;
|
|
|
|
|
debug : 是否为debug模式 , 为true时会打印出logack内部日志 , 便于查看logback实时信息 . 默认值false
|
|
|
|
|
<configuration scan="true" scanPeriod="60 seconds" debug="false"> -->
|
|
|
|
|
|
|
|
|
|
<!-- 定义变量 , 在配置文件其他地方可通过${变量名}访问 -->
|
|
|
|
|
<!--<property name="LOG_INFO_HOME" value="/Users/riemann/Documents/log" />-->
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 彩色日志 -->
|
|
|
|
|
<!-- 彩色日志依赖的渲染类 -->
|
|
|
|
|
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
|
|
|
|
<conversionRule conversionWord="wex"
|
|
|
|
|
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
|
|
|
|
<conversionRule conversionWord="wEx"
|
|
|
|
|
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
|
|
|
|
<!-- 彩色日志格式 -->
|
|
|
|
|
<property name="CONSOLE_LOG_PATTERN"
|
|
|
|
|
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
|
|
|
|
<!-- ConsoleAppender , 将日志输出到控制台 . 有encoder和target两个子节点 -->
|
|
|
|
|
<appender name="CONSOLE-LOG" class="ch.qos.logback.core.ConsoleAppender">
|
|
|
|
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
|
|
|
|
<!--<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}-%msg%n</pattern>-->
|
|
|
|
|
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
|
|
|
|
<charset>UTF-8</charset>
|
|
|
|
|
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
|
|
|
|
<contextName>logback</contextName>
|
|
|
|
|
<property name="log.path" value="../logs/SP_SYNC_SERVER"/>
|
|
|
|
|
<!-- 输出到控制台/home/glxpdata/udiwms/UDI_WMS_MC/-->
|
|
|
|
|
<!-- <property name="log.path" value="../logs/udiwms/"/>-->
|
|
|
|
|
<!--D:\\udi\\logs\\UDI_WMS_MC\\-->
|
|
|
|
|
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
|
|
|
|
<!-- <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
|
|
|
<level>ERROR</level>
|
|
|
|
|
</filter>-->
|
|
|
|
|
<encoder>
|
|
|
|
|
<pattern>%d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n</pattern>
|
|
|
|
|
</encoder>
|
|
|
|
|
</appender>
|
|
|
|
|
|
|
|
|
|
<!-- FileAppender , 将日志输出到文件 . 有file/append/encoder/prudent四个子节点 -->
|
|
|
|
|
<appender name="INFO-LOG"
|
|
|
|
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
|
|
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
|
|
|
<level>ERROR</level>
|
|
|
|
|
<onMatch>DENY</onMatch>
|
|
|
|
|
<onMismatch>ACCEPT</onMismatch>
|
|
|
|
|
</filter>
|
|
|
|
|
<!--输出到文件-->
|
|
|
|
|
|
|
|
|
|
<!--2. 输出到文档-->
|
|
|
|
|
<!-- 2.1 level为 DEBUG 日志,时间滚动输出 -->
|
|
|
|
|
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
|
|
|
<!-- 正在记录的日志文档的路径及文档名 -->
|
|
|
|
|
<file>${log.path}/web_debug.log</file>
|
|
|
|
|
<!--日志文档输出格式-->
|
|
|
|
|
<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">
|
|
|
|
|
<!-- 每天一归档 -->
|
|
|
|
|
<fileNamePattern>d://wmslog/SP_SYNC_SERVER/logs/${LOG_INFO_HOME}//%d{yyyy-MM-dd}_%i.log
|
|
|
|
|
</fileNamePattern>
|
|
|
|
|
<maxHistory>30</maxHistory>
|
|
|
|
|
<timeBasedFileNamingAndTriggeringPolicy
|
|
|
|
|
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
|
|
|
|
<!-- 最大64MB 超过最大值,会重新建一个文件 -->
|
|
|
|
|
<maxFileSize>64 MB</maxFileSize>
|
|
|
|
|
<!-- 日志归档 -->
|
|
|
|
|
<fileNamePattern>${log.path}/web-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
|
|
|
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
|
|
|
|
<maxFileSize>40MB</maxFileSize>
|
|
|
|
|
</timeBasedFileNamingAndTriggeringPolicy>
|
|
|
|
|
<!--日志文档保留天数-->
|
|
|
|
|
<maxHistory>15</maxHistory>
|
|
|
|
|
</rollingPolicy>
|
|
|
|
|
<!-- 此日志文档只记录debug级别的 -->
|
|
|
|
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
|
|
|
<level>debug</level>
|
|
|
|
|
<onMatch>ACCEPT</onMatch>
|
|
|
|
|
<onMismatch>DENY</onMismatch>
|
|
|
|
|
</filter>
|
|
|
|
|
</appender>
|
|
|
|
|
|
|
|
|
|
<!-- 2.2 level为 INFO 日志,时间滚动输出 -->
|
|
|
|
|
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
|
|
|
<!-- 正在记录的日志文档的路径及文档名 -->
|
|
|
|
|
<file>${log.path}/web_info.log</file>
|
|
|
|
|
<!--日志文档输出格式-->
|
|
|
|
|
<encoder>
|
|
|
|
|
<pattern>%d{yyyy-MM-dd HH:mm:ss:SSS} %-5level [%thread] %logger{50}-%L %msg%n</pattern>
|
|
|
|
|
<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">
|
|
|
|
|
<!-- 每天日志归档路径以及格式 -->
|
|
|
|
|
<fileNamePattern>${log.path}/web-info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
|
|
|
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
|
|
|
|
<maxFileSize>40MB</maxFileSize>
|
|
|
|
|
</timeBasedFileNamingAndTriggeringPolicy>
|
|
|
|
|
<!--日志文档保留天数-->
|
|
|
|
|
<maxHistory>15</maxHistory>
|
|
|
|
|
</rollingPolicy>
|
|
|
|
|
<!-- 此日志文档只记录info级别的 -->
|
|
|
|
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
|
|
|
<level>info</level>
|
|
|
|
|
<onMatch>ACCEPT</onMatch>
|
|
|
|
|
<onMismatch>DENY</onMismatch>
|
|
|
|
|
</filter>
|
|
|
|
|
</appender>
|
|
|
|
|
|
|
|
|
|
<appender name="ERROR-LOG"
|
|
|
|
|
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
|
|
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
|
|
|
<level>ERROR</level>
|
|
|
|
|
</filter>
|
|
|
|
|
<!-- 2.3 level为 WARN 日志,时间滚动输出 -->
|
|
|
|
|
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
|
|
|
<!-- 正在记录的日志文档的路径及文档名 -->
|
|
|
|
|
<file>${log.path}/web_warn.log</file>
|
|
|
|
|
<!--日志文档输出格式-->
|
|
|
|
|
<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">
|
|
|
|
|
<!-- 每天一归档 -->
|
|
|
|
|
<fileNamePattern>d://wmslog/SP_SYNC_SERVER/logs/${LOG_ERROR_HOME}//%d{yyyy-MM-dd}_%i.log
|
|
|
|
|
</fileNamePattern>
|
|
|
|
|
<maxHistory>30</maxHistory>
|
|
|
|
|
<timeBasedFileNamingAndTriggeringPolicy
|
|
|
|
|
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
|
|
|
|
<!-- 最大64MB 超过最大值,会重新建一个文件 -->
|
|
|
|
|
<maxFileSize>64 MB</maxFileSize>
|
|
|
|
|
<fileNamePattern>${log.path}/web-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
|
|
|
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
|
|
|
|
<maxFileSize>40MB</maxFileSize>
|
|
|
|
|
</timeBasedFileNamingAndTriggeringPolicy>
|
|
|
|
|
<!--日志文档保留天数-->
|
|
|
|
|
<maxHistory>15</maxHistory>
|
|
|
|
|
</rollingPolicy>
|
|
|
|
|
<!-- 此日志文档只记录warn级别的 -->
|
|
|
|
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
|
|
|
<level>warn</level>
|
|
|
|
|
<onMatch>ACCEPT</onMatch>
|
|
|
|
|
<onMismatch>DENY</onMismatch>
|
|
|
|
|
</filter>
|
|
|
|
|
</appender>
|
|
|
|
|
|
|
|
|
|
<!-- 2.4 level为 ERROR 日志,时间滚动输出 -->
|
|
|
|
|
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
|
|
|
|
<!-- 正在记录的日志文档的路径及文档名 -->
|
|
|
|
|
<file>${log.path}/web_error.log</file>
|
|
|
|
|
<!--日志文档输出格式-->
|
|
|
|
|
<encoder>
|
|
|
|
|
<pattern>%d{yyyy-MM-dd HH:mm:ss:SSS} %-5level [%thread] %logger{50}-%L %msg%n</pattern>
|
|
|
|
|
<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">
|
|
|
|
|
<fileNamePattern>${log.path}/web-error-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
|
|
|
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
|
|
|
|
<maxFileSize>40MB</maxFileSize>
|
|
|
|
|
</timeBasedFileNamingAndTriggeringPolicy>
|
|
|
|
|
<!--日志文档保留天数-->
|
|
|
|
|
<maxHistory>15</maxHistory>
|
|
|
|
|
</rollingPolicy>
|
|
|
|
|
<!-- 此日志文档只记录ERROR级别的 -->
|
|
|
|
|
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
|
|
|
<level>ERROR</level>
|
|
|
|
|
<onMatch>ACCEPT</onMatch>
|
|
|
|
|
<onMismatch>DENY</onMismatch>
|
|
|
|
|
</filter>
|
|
|
|
|
</appender>
|
|
|
|
|
|
|
|
|
|
<!-- logger 日志返回/级别及输出目标配置 有必填属性name和选填属性level/additivity , 一个appender-ref 子节点(可配置1个或多个)
|
|
|
|
|
name : 指定遵守该logger约束的一个包或具体的某个类
|
|
|
|
|
level : 日志级别 ,有以下值TRACE, DEBUG, INFO, WARN, ERROR, ALL, OFF , 不区分大小写
|
|
|
|
|
additivity : 是否向上级logger传递日志信息 , 默认为ture . (如果上级logger也输出日志 , 则会输出两份 . 所以通常情况下配置为false)
|
|
|
|
|
-->
|
|
|
|
|
<logger name="org.springframework.web" level="INFO"/>
|
|
|
|
|
<logger name="org.springframework" level="INFO"/>
|
|
|
|
|
<logger name="com.riemann.springbootdemo" level="DEBUG"/>
|
|
|
|
|
|
|
|
|
|
<!-- root本身也是一个logger节点(相当于name="root"的logger) , 但仅能配置一个 , 是所有logger的父级(可以理解为Java中的Object) , 只有一个level属性, 默认值DEBUG -->
|
|
|
|
|
<root level="INFO">
|
|
|
|
|
<appender-ref ref="CONSOLE-LOG"/>
|
|
|
|
|
<appender-ref ref="INFO-LOG"/>
|
|
|
|
|
<appender-ref ref="ERROR-LOG"/>
|
|
|
|
|
<root level="info">
|
|
|
|
|
<appender-ref ref="console"/>
|
|
|
|
|
<appender-ref ref="DEBUG_FILE"/>
|
|
|
|
|
<appender-ref ref="INFO_FILE"/>
|
|
|
|
|
<appender-ref ref="WARN_FILE"/>
|
|
|
|
|
<appender-ref ref="ERROR_FILE"/>
|
|
|
|
|
</root>
|
|
|
|
|
</configuration>
|
|
|
|
|
|
|
|
|
|
<!-- logback为java中的包 -->
|
|
|
|
|
<!--<logger name="com.dudu.controller"/>-->
|
|
|
|
|
<!--logback.LogbackDemo:类的全路径 -->
|
|
|
|
|
<!--<logger name="com.dudu.controller.LearnController" level="WARN" additivity="true">-->
|
|
|
|
|
<!--<appender-ref ref="console"/>-->
|
|
|
|
|
<!--</logger>-->
|
|
|
|
|
|
|
|
|
|
<!-- 测试环境+开发环境. 多个使用逗号隔开. -->
|
|
|
|
|
<springProfile name="dev">
|
|
|
|
|
<logger name="com.glxp.api.admin" level="info"/>
|
|
|
|
|
</springProfile>
|
|
|
|
|
<!-- 生产环境. -->
|
|
|
|
|
|
|
|
|
|
</configuration>
|
|
|
|
|