Last active
August 29, 2015 14:05
-
-
Save akunzai/3fa7208231f2ddbb5aa4 to your computer and use it in GitHub Desktop.
logback xml configuration example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<configuration scan="true" scanPeriod="30 seconds" debug="false"> | |
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | |
<encoder> | |
<charset>utf-8</charset> | |
<pattern>%date [%thread] %-5level %logger{39} - %msg%n</pattern> | |
</encoder> | |
</appender> | |
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | |
<!--See also http://logback.qos.ch/manual/appenders.html#RollingFileAppender--> | |
<file>${catalina.base}/logs/error.log</file> | |
<encoder> | |
<charset>utf-8</charset> | |
<pattern>%date %-5level %logger{39} [%file:%line] - %msg%n%ex{full}</pattern> | |
</encoder> | |
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | |
<level>ERROR</level> | |
</filter> | |
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> | |
<!-- daily rollover --> | |
<FileNamePattern>${catalina.base}/logs/error.%d{yyyy-MM-dd}.log.gz</FileNamePattern> | |
<!-- keep 30 days' worth of history --> | |
<maxHistory>30</maxHistory> | |
</rollingPolicy> | |
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> | |
<maxFileSize>10MB</maxFileSize> | |
</triggeringPolicy> | |
</appender> | |
<appender name="EMAIL" class="ch.qos.logback.classic.net.SMTPAppender"> | |
<!--See also http://logback.qos.ch/manual/appenders.html#SMTPAppender--> | |
<smtpHost>localhost</smtpHost> | |
<from>Alert<[email protected]></from> | |
<to>[email protected]</to><!-- additional destinations are possible --> | |
<subject>ERROR: %logger{20} - %m</subject> | |
<layout class="ch.qos.logback.classic.PatternLayout"> | |
<pattern>%date %-5level %logger{39} [%file:%line] - %msg%n%ex{full}</pattern> | |
</layout> | |
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | |
<level>ERROR</level> | |
</filter> | |
</appender> | |
<!-- Note that unlike log4j, logback-classic does not close nor remove any previously referenced appenders when configuring a given logger. --> | |
<logger name="org.hibernate.validator.internal.util.Version" level="WARN"/> | |
<logger name="org.apache.coyote.http11.Http11NioProtocol" level="WARN"/> | |
<logger name="org.crsh.plugin" level="WARN"/> | |
<logger name="org.apache.tomcat.util.net.NioSelectorPool" level="WARN"/> | |
<logger name="org.apache.catalina.startup.DigesterFactory" level="ERROR"/> | |
<logger name="org.apache.catalina.util.LifecycleBase" level="ERROR"/> | |
<logger name="org.eclipse.jetty.util.component.AbstractLifeCycle" level="ERROR"/> | |
<logger name="org.springframework" level="ERROR"/> | |
<logger name="org.jasig.cas" level="INFO"/> | |
<logger name="org.jasig.cas.web.view.CasReloadableMessageBundle" level="ERROR"/> | |
<logger name="org.pac4j.oauth.client" level="WARN"/> | |
<root level="INFO"> | |
<appender-ref ref="CONSOLE"/> | |
<appender-ref ref="FILE"/> | |
<appender-ref ref="EMAIL"/> | |
</root> | |
</configuration> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment