logback配置文件

简介: logbackspring配置文件
<?xmlversion="1.0" encoding="UTF-8"?><configuration><timestampkey = "timePattern"datePattern = "yyyy-MM-dd"/><springPropertyscope="context"name="sysCode"source="open.tenant.code"defaultValue="default"/><springPropertyscope="context"name="appCode"source="spring.application.name"defaultValue="default"/><springPropertyscope="context"name="appInstGrpCode"source="spring.profiles.active"defaultValue="default"/><springPropertyscope="context"name="appInstId"source="open.tenant.instant-id"defaultValue=""/><propertyname="log.charset"value="UTF-8"/><propertyname="log.file-size"value="100 MB"/><!--输出到控制台--><appendername="debugConsoleWithColor"class="ch.qos.logback.core.ConsoleAppender"><encoder><pattern>%highlight([%-5p]) %blue([${PID:- }]) %yellow([%date{yyyy-MM-dd HH:mm:ss.SSS}]) %green([${sysCode:-},${appCode:-},${appInstGrpCode:-},${appInstId:-}]) %magenta([%t] %-40.40logger{39}[%line]) : %cyan(%msg%n)</pattern><charset>${log.charset}</charset></encoder><filterclass="ch.qos.logback.classic.filter.ThresholdFilter"><level>debug</level></filter></appender><!--输出到控制台--><appendername="debugConsole"class="ch.qos.logback.core.ConsoleAppender"><encoder><pattern>[%-5p] [${PID:- }] [%date{yyyy-MM-dd HH:mm:ss.SSS}] [${sysCode:-},${appCode:-},${appInstGrpCode:-},${appInstId:-}] [%t] %-40.40logger{39} [%line] :%msg%n</pattern><charset>${log.charset}</charset></encoder><filterclass="ch.qos.logback.classic.filter.ThresholdFilter"><level>debug</level></filter></appender><!--输出到文件--><appendername="info-file"class="ch.qos.logback.core.rolling.RollingFileAppender"><encoder><pattern>[%-5p] [${PID:- }] [%date{yyyy-MM-dd HH:mm:ss.SSS}] [${sysCode:-},${appCode:-},${appInstGrpCode:-},${appInstId:-}] [%t] %-40.40logger{39} [%line] :%msg%n </pattern><charset>${log.charset}</charset></encoder><rollingPolicyclass="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"><!-- rollover daily 配置日志所生成的目录以及生成文件名的规则 --><fileNamePattern>/app/logs/%d{yyyy-MM-dd}/${appCode}/${appCode}-info.%i.log</fileNamePattern><MaxHistory>36</MaxHistory><timeBasedFileNamingAndTriggeringPolicyclass="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"><!-- or whenever the file size reaches 64 MB --><maxFileSize>${log.file-size}</maxFileSize></timeBasedFileNamingAndTriggeringPolicy></rollingPolicy><filterclass="ch.qos.logback.classic.filter.ThresholdFilter"><level>info</level></filter></appender><!--输出到文件--><appendername="error-file"class="ch.qos.logback.core.rolling.RollingFileAppender"><encoder><pattern>[%-5p] [${PID:- }] [%date{yyyy-MM-dd HH:mm:ss.SSS}] [${sysCode:-},${appCode:-},${appInstGrpCode:-},${appInstId:-}] [%t] %-40.40logger{39} [%line] :%msg%n </pattern><charset>${log.charset}</charset></encoder><rollingPolicyclass="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"><!-- rollover daily 配置日志所生成的目录以及生成文件名的规则 --><fileNamePattern>/app/logs/%d{yyyy-MM-dd}/${appCode}/${appCode}-error.%i.log</fileNamePattern><MaxHistory>36</MaxHistory><timeBasedFileNamingAndTriggeringPolicyclass="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"><!-- or whenever the file size reaches 64 MB --><maxFileSize>${log.file-size}</maxFileSize></timeBasedFileNamingAndTriggeringPolicy></rollingPolicy><filterclass="ch.qos.logback.classic.filter.ThresholdFilter"><level>error</level></filter></appender><springProfilename="production||testing||pro||test"><rootlevel = "INFO"><appender-refref="debugConsole"/></root></springProfile><springProfilename="!(production||testing||pro||test)"><loggername="org.springframework.jdbc.datasource"level="debug"/><loggername="org.mybatis.spring.transaction"level="debug"/><loggername="com.ibatis"level="debug"/><loggername="com.ibatis.common.jdbc.SimpleDataSource"level="debug"/><loggername="com.ibatis.common.jdbc.ScriptRunner"level="debug"/><loggername="com.ibatis.common.sqlmap.engine.impl.SqlMapClientDelegate"level="debug"/><loggername="java.sql.Connection"level="debug"/><loggername="java.sql.Statement"level="debug"/><loggername="java.sql.ResultSet"level="debug"/><loggername="java.sql.PreparedStatement"level="debug"/><rootlevel = "INFO"><appender-refref="debugConsoleWithColor"/></root></springProfile></configuration>
相关文章
|
6月前
|
Java
LogBack配置文件使用示例
LogBack配置文件使用示例 LogBack配置文件使用示例
51 0
|
Java API Apache
springboot 日志配置(logback)(一)
springboot 日志配置(logback)
428 0
|
缓存 Java API
logback配置
一、logback介绍 logback分成三个模块:logback-core,logback- classic,logback-access。 logback-core:提供了logBack的核心功能,是另外两个组件的基础; logback-classic:实现了SLF4J API; logback
722 0
|
3月前
logback.xml 配置文件
logback.xml 配置文件
20 0
|
6月前
|
Java API 开发者
Logback简介与配置详解
在开发和维护Spring Boot应用程序时,一个强大而灵活的日志框架是至关重要的。Spring Boot默认集成了Logback,一个高性能的Java日志框架。本文将介绍如何配置Logback以满足你的日志记录需求。
263 1
 Logback简介与配置详解
|
6月前
|
Java
logback配置,命名为logback-spring.xml
logback配置,命名为logback-spring.xml
|
XML SQL Java
springboot 日志配置(logback)(二)
springboot 日志配置(logback)(二)
251 0
[logback.xml配置] 备份
[logback.xml配置] 备份
100 1
|
Java API 计算机视觉
springboot启动报错LoggerFactory is not a Logback LoggerContext but Logback...
今天做人脸识别的Demo,引入的百度的API,里面用了slf4j,然后就导致日志冲突了。
|
XML 安全 Oracle
logback的使用和logback.xml详解
logback的使用和logback.xml详解