加点日志文件的写入
This commit is contained in:
parent
d2439cd096
commit
004537b865
|
@ -23,3 +23,4 @@ nbbuild/
|
||||||
dist/
|
dist/
|
||||||
nbdist/
|
nbdist/
|
||||||
.nb-gradle/
|
.nb-gradle/
|
||||||
|
logs/
|
||||||
|
|
|
@ -1,9 +1,47 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<!--指定property属性变量-->
|
||||||
|
<property name="LOG_HOME" value="./logs/" />
|
||||||
|
|
||||||
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
<include resource="org/springframework/boot/logging/logback/base.xml"/>
|
||||||
<logger name="org.springframework.web" level="INFO"/>
|
<logger name="org.springframework.web" level="INFO"/>
|
||||||
<logger name="org.springboot.sample" level="TRACE"/>
|
<logger name="org.springboot.sample" level="TRACE"/>
|
||||||
|
|
||||||
|
|
||||||
|
<appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/service.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/service.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||||
|
<MaxHistory>120</MaxHistory>
|
||||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||||
|
<maxFileSize>500MB</maxFileSize>
|
||||||
|
</timeBasedFileNamingAndTriggeringPolicy>
|
||||||
|
</rollingPolicy>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}[%L] - %msg%n</pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<appender name="FILE_ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
|
<file>${LOG_HOME}/error.log</file>
|
||||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||||
|
<fileNamePattern>${LOG_HOME}/error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||||
|
<MaxHistory>120</MaxHistory>
|
||||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||||
|
<maxFileSize>500MB</maxFileSize>
|
||||||
|
</timeBasedFileNamingAndTriggeringPolicy>
|
||||||
|
</rollingPolicy>
|
||||||
|
<!-- 过滤日志 -->
|
||||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
|
<level>ERROR</level>
|
||||||
|
</filter>
|
||||||
|
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}[%L] - %msg%n</pattern>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
<!-- 开发、测试环境 -->
|
<!-- 开发、测试环境 -->
|
||||||
<springProfile name="dev,test">
|
<springProfile name="dev,test">
|
||||||
<logger name="org.springframework.web" level="INFO"/>
|
<logger name="org.springframework.web" level="INFO"/>
|
||||||
|
@ -13,9 +51,16 @@
|
||||||
|
|
||||||
<!-- 生产环境 -->
|
<!-- 生产环境 -->
|
||||||
<springProfile name="prod">
|
<springProfile name="prod">
|
||||||
<logger name="org.springframework.web" level="ERROR"/>
|
<logger name="org.springframework.web" level="ERROR">
|
||||||
<logger name="org.springboot.sample" level="ERROR" />
|
<appender-ref ref="STDOUT"/>
|
||||||
<logger name="io.renren" level="ERROR" />
|
</logger>
|
||||||
|
<logger name="org.springboot.sample" level="ERROR"></logger>
|
||||||
|
<logger name="io.renren" level="ERROR"></logger>
|
||||||
</springProfile>
|
</springProfile>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="FILE_INFO"/>
|
||||||
|
<appender-ref ref="FILE_ERROR"/>
|
||||||
|
</root>
|
||||||
|
|
||||||
</configuration>
|
</configuration>
|
Loading…
Reference in New Issue