ycode8.dynamic-datasource-sample.1.0.1.source-code.logback.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8"?> <configuration> <!-- 默认的CONSOLE/FILE appender--> <!--<include resource="org/springframework/boot/logging/logback/base.xml"/>--> <!-- 提供颜色支持--> <include resource="org/springframework/boot/logging/logback/defaults.xml" /> <property name="LOG_HOME" value="./target/log" /> <!--每天生成一个日志文件,只保存7天的日志文件。--> <appender name="dailyFile" class="ch.qos.logback.core.rolling.RollingFileAppender"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <fileNamePattern>${LOG_HOME}/log_daily.%d{yyyy-MM-dd}.log</fileNamePattern> <!--归档日志压缩zip--> <!--<fileNamePattern>${LOG_HOME}/demo-aop-log_daily.%d{yyyy-MM-dd}.log.zip</fileNamePattern>--> <maxHistory>7</maxHistory> </rollingPolicy> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} %X{requestId} %X{localIp} %X{uri} - %msg%n</pattern> </encoder> </appender> <appender name="console" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%clr(%d{${LOG_DATEFORMAT_PATTERN:-yyyy-MM-dd HH:mm:ss.SSS}}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} [%X{requestId}] [%X{localIp}] %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}</pattern> </encoder> </appender> <!--additivity="false" 表示只用当前logger的appender-ref--> <logger name="com.easycode8.datasource.dynamic" additivity="true" level="DEBUG"/> <logger name="org.springframework.web" level="info" /> <!--log4jdbc--> <logger name="jdbc" additivity="false" level="OFF"> <appender-ref ref="console" /> </logger> <logger name="jdbc.sqltiming" additivity="false" level="DEBUG"> <appender-ref ref="console" /> </logger> <!-- root --> <root level="info"> <appender-ref ref="console" /> </root> </configuration>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy