[logback-user] Using conditional processing
Michael C Rosenstein
mcr at mdibl.org
Tue Jan 25 21:26:00 CET 2011
On 1/25/2011 14:58, Ceki Gülcü wrote:
> I forgot to mention that conditional processing requires the janino
> library.
Yes! Adding janino.jar and commons-compiler.jar to the classpath fixed
the problem. I must have missed that requirement in the docs. Thank you!
For complete clarification, here is an excerpt of my config file:
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true" scan="true" scanPeriod="10 minutes">
<!-- ${catalina.home} is set by tomcat-jsvc.sh. -->
<statusListener
class="ch.qos.logback.core.status.OnConsoleStatusListener"/>
<logger name="org.mdibl.ctd.pwa.admin.web.AppStatus" level="INFO"/>
<logger name="org.mdibl.ctd.pwa.servlets.AuthorRedirect" level="INFO"/>
<logger name="org.mdibl.ctd.pwa.queries.web.BasicQueryController"
level="INFO"/>
<!-- Email appender (don't need for dev server). -->
<if condition='!property("HOSTNAME").contains("hactar")'>
<then>
<appender name="EMAIL"
class="ch.qos.logback.classic.net.SMTPAppender">
<smtpHost>xxx.xxx.xxx</smtpHost>
<to>xxxxxx at xxx.xxx</to>
<from>xxxxx at xxx.xxx</from>
<subject>${HOSTNAME} %level: %logger{30}</subject>
<layout class="ch.qos.logback.classic.html.HTMLLayout">
<pattern>%d%level%logger%msg</pattern>
</layout>
<cyclicBufferTracker
class="ch.qos.logback.core.spi.CyclicBufferTrackerImpl">
<bufferSize>128</bufferSize>
</cyclicBufferTracker>
</appender>
<root>
<appender-ref ref="EMAIL"/>
</root>
</then>
</if>
<!-- Daily rolling file appender (all servers). -->
<appender name="RFILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<File>${catalina.home}/logs/lb_tomcat.log</File>
<encoder>
<pattern>%d{HH:mm:ss.SSS} %-5level %logger{40} -
%msg%n</pattern>
</encoder>
<rollingPolicy
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- Rollover file daily -->
<fileNamePattern>${catalina.home}/logs/tomcat.%d.log</fileNamePattern>
<!-- Keep 30 days of history -->
<maxHistory>30</maxHistory>
</rollingPolicy>
</appender>
<root level="WARN">
<appender-ref ref="RFILE"/>
</root>
</configuration>
More information about the Logback-user
mailing list