You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?xml version="1.0" encoding="UTF-8"?> <configuration debug="false" scan="false" scanPeriod="60 seconds"> <property name="LOG_HOME" value="./logs/logback"/> <property name="appName" value="lzy-logDemo"/>
<!-- 定义控制台输出 --> <appender name="stdout" 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="appLogAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> <!-- 指定日志文件的名称 --> <file>${LOG_HOME}/${appName}.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${LOG_HOME}/${appName}-%d{yyyy-MM-dd}-%i.log</fileNamePattern> <MaxHistory>30</MaxHistory> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <MaxFileSize>10MB</MaxFileSize> </timeBasedFileNamingAndTriggeringPolicy> </rollingPolicy>
<layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [ %thread ] - [ %-5level ] [ %logger{50} : %line ] - %msg%n</pattern> </layout> </appender>
<!-- 日志输出级别 --> <logger name="org.springframework" level="debug" additivity="false"/> <logger name="com.lzy.logdemo" level="debug"/> <root level="INFO"> <appender-ref ref="stdout"/> <appender-ref ref="appLogAppender"/> </root> </configuration>
|