|
@@ -0,0 +1,193 @@
|
|
|
+<?xml version="1.0" encoding="UTF-8"?>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 当scan为true时,此属性生效。默认的时间间隔为1分钟。 -->
|
|
|
+
|
|
|
+<configuration scan="true" scanPeriod="10 seconds">
|
|
|
+ <contextName>logback</contextName>
|
|
|
+
|
|
|
+
|
|
|
+ <property name="log.path" value="./logFiles" />
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <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}}"/>
|
|
|
+
|
|
|
+
|
|
|
+ <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
|
|
+
|
|
|
+ <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
|
|
+ <level>debug</level>
|
|
|
+ </filter>
|
|
|
+ <encoder>
|
|
|
+ <Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
|
|
|
+
|
|
|
+ <charset>UTF-8</charset>
|
|
|
+ </encoder>
|
|
|
+ </appender>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <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>${log.path}/web-debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
|
|
+ <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
|
|
+ <maxFileSize>100MB</maxFileSize>
|
|
|
+ </timeBasedFileNamingAndTriggeringPolicy>
|
|
|
+
|
|
|
+ <maxHistory>15</maxHistory>
|
|
|
+ </rollingPolicy>
|
|
|
+
|
|
|
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
|
+ <level>debug</level>
|
|
|
+ <onMatch>ACCEPT</onMatch>
|
|
|
+ <onMismatch>DENY</onMismatch>
|
|
|
+ </filter>
|
|
|
+ </appender>
|
|
|
+
|
|
|
+
|
|
|
+ <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} [%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>100MB</maxFileSize>
|
|
|
+ </timeBasedFileNamingAndTriggeringPolicy>
|
|
|
+
|
|
|
+ <maxHistory>15</maxHistory>
|
|
|
+ </rollingPolicy>
|
|
|
+
|
|
|
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
|
+ <level>info</level>
|
|
|
+ <onMatch>ACCEPT</onMatch>
|
|
|
+ <onMismatch>DENY</onMismatch>
|
|
|
+ </filter>
|
|
|
+ </appender>
|
|
|
+
|
|
|
+
|
|
|
+ <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>${log.path}/web-warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
|
|
+ <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
|
|
+ <maxFileSize>100MB</maxFileSize>
|
|
|
+ </timeBasedFileNamingAndTriggeringPolicy>
|
|
|
+
|
|
|
+ <maxHistory>15</maxHistory>
|
|
|
+ </rollingPolicy>
|
|
|
+
|
|
|
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
|
+ <level>warn</level>
|
|
|
+ <onMatch>ACCEPT</onMatch>
|
|
|
+ <onMismatch>DENY</onMismatch>
|
|
|
+ </filter>
|
|
|
+ </appender>
|
|
|
+
|
|
|
+
|
|
|
+ <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} [%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>100MB</maxFileSize>
|
|
|
+ </timeBasedFileNamingAndTriggeringPolicy>
|
|
|
+
|
|
|
+ <maxHistory>15</maxHistory>
|
|
|
+ </rollingPolicy>
|
|
|
+
|
|
|
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
|
|
|
+ <level>ERROR</level>
|
|
|
+ <onMatch>ACCEPT</onMatch>
|
|
|
+ <onMismatch>DENY</onMismatch>
|
|
|
+ </filter>
|
|
|
+ </appender>
|
|
|
+
|
|
|
+
|
|
|
+ <logger>用来设置某一个包或者具体的某一个类的日志打印级别、
|
|
|
+ 以及指定<appender>。<logger>仅有一个name属性,
|
|
|
+ 一个可选的level和一个可选的addtivity属性。
|
|
|
+ name:用来指定受此logger约束的某一个包或者具体的某一个类。
|
|
|
+ level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
|
|
|
+ 还有一个特俗值INHERITED或者同义词NULL,代表强制执行上级的级别。
|
|
|
+ 如果未设置此属性,那么当前logger将会继承上级的级别。
|
|
|
+ addtivity:是否向上级logger传递打印信息。默认是true。
|
|
|
+ <logger name="org.springframework.web" level="info"/>
|
|
|
+ <logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>
|
|
|
+ -->
|
|
|
+
|
|
|
+
|
|
|
+ 使用mybatis的时候,sql语句是debug下才会打印,而这里我们只配置了info,所以想要查看sql语句的话,有以下两种操作:
|
|
|
+ 第一种把<root level="info">改成<root level="DEBUG">这样就会打印sql,不过这样日志那边会出现很多其他消息
|
|
|
+ 第二种就是单独给dao下目录配置debug模式,代码如下,这样配置sql语句会打印,其他还是正常info级别:
|
|
|
+ 【logging.level.org.mybatis=debug logging.level.dao=debug】
|
|
|
+ -->
|
|
|
+
|
|
|
+
|
|
|
+ root节点是必选节点,用来指定最基础的日志输出级别,只有一个level属性
|
|
|
+ level:用来设置打印级别,大小写无关:TRACE, DEBUG, INFO, WARN, ERROR, ALL 和 OFF,
|
|
|
+ 不能设置为INHERITED或者同义词NULL。默认是DEBUG
|
|
|
+ 可以包含零个或多个元素,标识这个appender将会添加到这个logger。
|
|
|
+ -->
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <logger name="com.sdcm.pmp" level="debug"/>
|
|
|
+ </springProfile> -->
|
|
|
+
|
|
|
+ <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>
|
|
|
+
|
|
|
+
|
|
|
+ <springProfile name="pro">
|
|
|
+ <root level="info">
|
|
|
+ <appender-ref ref="CONSOLE" />
|
|
|
+ <appender-ref ref="DEBUG_FILE" />
|
|
|
+ <appender-ref ref="INFO_FILE" />
|
|
|
+ <appender-ref ref="ERROR_FILE" />
|
|
|
+ <appender-ref ref="WARN_FILE" />
|
|
|
+ </root>
|
|
|
+ </springProfile> -->
|
|
|
+
|
|
|
+</configuration>
|