logback配置手册

下面是项目新增sentry的logback配置

<configuration>
  <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
    <encoder>
      <pattern>
      %date{HH:mm:ss} [%thread] %-5level %logger{36} - %msg \(%file:%line\)%n</pattern>
    </encoder>
  </appender>
  
  <appender name="Sentry" class="net.kencochrane.raven.logback.SentryAppender">
	   <filter class="ch.qos.logback.classic.filter.LevelFilter">   
	 		<level>ERROR</level>   
			<onMatch>ACCEPT</onMatch>   
			<onMismatch>DENY</onMismatch> 
	   </filter>
	   <dsn>
	       http://0aad617a92ae4d8cb24ec89a4e76056c:[email protected]:9000/2
	   </dsn>
    </appender>
    	
  
  <logger name="org.apache" level="WARN"/>
  <logger name="org.apache.zookeeper.ClientCnxn" level="ERROR"/>
  <logger name="org.jboss.security" level="FATAL"/>
  <logger name="java.sql" level="INFO"/>

  <root level="INFO">		
    <appender-ref ref="STDOUT" />
    <appender-ref ref="Sentry"/>
  </root>  
  
</configuration>

 

参考:

原创文章,转载请指明出处:http://aub.iteye.com/blog/1101260, 尊重他人即尊重自己

详细整理了logback常用配置,

不是官网手册的翻译版,而是使用总结,旨在更快更透彻的理解其配置

logback 常用配置详解(序)logback 简介

logback 常用配置详解(一)<configuration> and <logger>

logback 常用配置详解(二)<appender>

logback 常用配置详解(三)<filter>

logback 中文手册 官网手册的翻译版,在这里向中文版译者-陈华,说声辛苦啦

你可能感兴趣的:(logback)