logback.xml 单独配置class 日志级别并且显示类名和行数
2016-08-29 00:00
1111 查看
1、对某个包下面的class 单独配置日志级别-Example
Setting the level of a logger or root logger is as simple as declaring it and setting its level, as the next example illustrates. Suppose we are no longer interested in seeing any DEBUG messages from any component belonging to the "chapters.configuration" package. The following configuration file shows how to achieve that.Example: Setting the level of a logger (logback-examples/src/main/resources/chapters/configuration/sample2.xml)
View as .groovy
<configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> <encoder> <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> </encoder> </appender> <logger name="chapters.configuration" level="INFO"/> <!-- Strictly speaking, the level attribute is not necessary since --> <!-- the level of the root level is set to DEBUG by default. --> <root level="DEBUG"> <appender-ref ref="STDOUT" /> </root> </configuration>
logback.xml可以单独配置日志运行的级别。
2、配置日志打印行数和类名
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern>%date-%level-[%F:%L]-[%thread]-%msg%n</pattern> ##F 类名 L 行数 </encoder> </appender>
相关文章推荐
- spring boot + spring cloud日志级别的配置logback.xml
- logback.xml配置如何按天输出日志文件
- logback.xml日志配置
- logback.xml---日志配置
- 【spring boot logback】日志使用自定义的logback-spring.xml文件后,application.properties中关于日志的相关配置还会起作用么
- 使用logback.xml配置来实现日志文件输出
- logback.xml配置如何按天输出日志文件
- logback.xml按时间和文件大小生成日志(分级别)
- 通过配置logback.xml将日志写入数据库
- logback 配置不同级别日志输出
- 【spring boot logback】日志颜色渲染,使用logback-spring.xml自定义的配置文件后,日志没有颜色了
- 使用 WLST 工具配置weblogic日志显示级别
- logback日志配置文件---Logback.xml
- spring boot 日志配置 logback-spring.xml
- 把项目下的jar迁移到tomcat的lib目录下,原本的logback日志配置会失效,产生大量debugger级别日志
- logback动态修改配置文件实现打印不同级别日志
- 关于springboot的默认日志配置文件logback.xml
- Log4j和logback冲突,导致log4j配置失效控制台一直打印DEBUG级别的日志
- maven 项目 springmvc spring 使用SLF4J和 LogBack 做为日志 xml里配置即可
- logback.xml日志文件配置