loback的配置
2019獨角獸企業重金招聘Python工程師標準>>>
Logback常用配置詳解
<root><level value="INFO" /><if condition ='property("DEPLOY_ENV")== "" ||property("DEPLOY_ENV").equals("dev")'><then><appender-ref ref="STDOUT" /></then></if><appender-ref ref="infoAppender" /><appender-ref ref="errorAppender" /> </root>使用報錯:
需要添加包:
<dependency><groupId>org.codehaus.janino</groupId><artifactId>janino</artifactId><version>3.0.8</version> </dependency>實例:
<?xml version="1.0" encoding="UTF-8"?> <!-- 只需配置好 log.dir 和 projectname 屬性 --> <configuration debug="false"><property name="log.dir" value="/alidata1/admin/${log.dir}noob-mics/logs" /><property name="projectname" value="noobmics" /><appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"><target>System.out</target><encoder charset="UTF-8"><pattern>%d [%thread] %-5p [%c] [%F:%L] - %msg%n</pattern></encoder></appender><appender name="infoAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"><file>${log.dir}/${log.dir}noob-ss_regular_app_${projectname}_lt_info.log</file><filter class="ch.qos.logback.classic.filter.ThresholdFilter"><level>INFO</level></filter><rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"><fileNamePattern>${log.dir}/${log.dir}noob-ss_regular_app_${projectname}_lt_info-%d{yyyy-MM-dd}.log</fileNamePattern><maxHistory>30</maxHistory></rollingPolicy><encoder charset="UTF-8"><pattern>%d [%thread] %-5p [%c] [%F:%L][trace=%X{X-Trace-Id:-},span=%X{X-Span-Id:-},parent=%X{X-Parent-Id:-},name=%X{X-Span-Name:-},app=%X{appname:-},begintime=%X{begintime:-},endtime=%X{fin-X1-time:-}]- %msg%n</pattern></encoder></appender>#if(property("DEPLOY_ENV")== "" || property("DEPLOY_ENV").equals("dev"))<logger name="org.mybatis.spring" level="DEBUG" /><logger name="java.sql" level="DEBUG" />#end<logger name="org.apache"><level value="INFO" /></logger><logger name="org.springframework"><level value="INFO" /></logger><logger name="com.alibaba.citrus.springext.support.context"><level value="INFO" /></logger><root><level value="INFO" /><if condition ='property("DEPLOY_ENV")== "" ||property("DEPLOY_ENV").equals("dev")'><then><appender-ref ref="STDOUT" /></then></if><appender-ref ref="infoAppender" /><appender-ref ref="errorAppender" /></root> </configuration>?
轉載于:https://my.oschina.net/u/3434392/blog/1803323
總結
- 上一篇: Centos 7 mysql Buffe
- 下一篇: POJ 放苹果问题(递归)