Hello,

We have been using logback for some time now. Up until now, we've been using 
1.1.2 (and sometime, 0.98) and I've been experimenting with version 1.2.3 
lately (to implement logstach through logback).
We're mostly using Tomcat, some which are running war made by us, some which 
are running 3rd parties applications which we have no control into what 
dependencies are packaged into.

All our tomcat are configured to have logback core libraries ( logback-core, 
logback-classic, logback-access, slf4j-api,  jul-to-slf4j  and log4j-over-slf4j 
) loaded on the JDK classpath to insure that everything that log something 
(tomcat, the webapp, Java itself)  log through logback).

As a result, I more than often get multiple binding warning during startup.

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in 
[jar:file:/home/tomcat/wars/current/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
  ( The one from the JDK classpath)
SLF4J: Found binding in 
[jar:file:/home/tomcat/servers/TOMCAT/webapps/ROOT/WEB-INF/lib/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
 (The one from the Webapp)
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type 
[ch.qos.logback.classic.util.ContextSelectorStaticBinder]


Until version 1.2.3, other than a warning, this caused no issue.  GZIP rotation 
would occur without problem at every night.
However, during my test with 1.2.3, I started to find .tmp files left after 
tomcat restart. Some of them containing some  logs absent from the current day 
logs.

If I remove from the webapp all the logback jars that were in the Java's 
classpath , then I can restart tomcat without any tmp file being left.

This feel to me like a concurrency race between both binding during rotation, 
the webapp closing before the jdk does.

Is there some configuration I may be missing to prevent this? While I can get our 
developers to modify the maven pom to set the logback depedencies to 
"provided", dealing with 3rd parties War is more complicated.


Here's my logback.xml configuration file, set through the 
logback.configurationFile system property:


Thanks,

--------------------------------
<?xml version="1.0"?>
<configuration scan="true" scanPeriod="60000">
   <property name="log_pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSSZ,America/Montreal} 
[%thread] %-5level %logger{36} - %msg%n"/>
   <property name="log_prefix" 
value="/home/log/tomcat/traces/TOMCAT.${HOSTNAME}"/>
   <shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
   <contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
       <resetJUL>true</resetJUL>
   </contextListener>
   <jmxConfigurator/>
   <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
       <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
           <level>WARN</level>
       </filter>
       <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
           <pattern>${log_pattern}</pattern>
       </encoder>
       <target>System.out</target>
   </appender>
   <appender name="LOGSTASH" 
class="net.logstash.logback.appender.LogstashTcpSocketAppender">
       <destination>logstach.example.com</destination>
       <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
           <level>WARN</level>
       </filter>
       <encoder class="net.logstash.logback.encoder.LogstashEncoder">
           <customFields>{"instance":"TOMCAT", "host":"${HOSTNAME}", "env":"DEV", 
"group":"TOMCAT"}</customFields>
       </encoder>
   </appender>
   <appender name="CONSOLE-INFO" class="ch.qos.logback.core.ConsoleAppender">
       <filter class="ch.qos.logback.classic.filter.LevelFilter">
           <level>INFO</level>
           <onMatch>ACCEPT</onMatch>
           <onMismatch>DENY</onMismatch>
       </filter>
       <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
           <pattern>${log_pattern}</pattern>
       </encoder>
       <target>System.out</target>
   </appender>
   <appender name="DEBUG" 
class="ch.qos.logback.core.rolling.RollingFileAppender">
       <filter class="ch.qos.logback.classic.filter.LevelFilter">
           <level>DEBUG</level>
           <onMatch>ACCEPT</onMatch>
           <onMismatch>DENY</onMismatch>
       </filter>
       <file>${log_prefix}.debug</file>
       <rollingPolicy 
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
           
<fileNamePattern>${log_prefix}.debug.%d{yyyy-MM-dd}.gz</fileNamePattern>
           <maxHistory>14</maxHistory>
       </rollingPolicy>
       <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
           <pattern>${log_pattern}</pattern>
       </encoder>
   </appender>
   <appender name="INFO" 
class="ch.qos.logback.core.rolling.RollingFileAppender">
       <filter class="ch.qos.logback.classic.filter.LevelFilter">
           <level>INFO</level>
           <onMatch>ACCEPT</onMatch>
           <onMismatch>DENY</onMismatch>
       </filter>
       <file>${log_prefix}.info</file>
       <rollingPolicy 
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
           
<fileNamePattern>${log_prefix}.info.%d{yyyy-MM-dd}.gz</fileNamePattern>
           <maxHistory>14</maxHistory>
       </rollingPolicy>
       <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
           <pattern>${log_pattern}</pattern>
       </encoder>
   </appender>
   <appender name="ERROR" 
class="ch.qos.logback.core.rolling.RollingFileAppender">
       <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
           <level>WARN</level>
       </filter>
       <file>${log_prefix}.error</file>
       <rollingPolicy 
class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
           
<fileNamePattern>${log_prefix}.error.%d{yyyy-MM-dd}.gz</fileNamePattern>
           <maxHistory>14</maxHistory>
       </rollingPolicy>
       <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
           <pattern>${log_pattern}</pattern>
       </encoder>
   </appender>
   <root level="INFO">
       <appender-ref ref="CONSOLE"/>
       <appender-ref ref="DEBUG"/>
       <appender-ref ref="INFO"/>
       <appender-ref ref="ERROR"/>
       <appender-ref ref="LOGSTASH"/>
   </root>
   <logger name="org.apache.catalina" level="INFO">
       <appender-ref ref="CONSOLE-INFO"/>
   </logger>
   <logger name="org.apache.coyote" level="INFO">
       <appender-ref ref="CONSOLE-INFO"/>
   </logger>
   <include file="/home/tomcat/servers/TOMCAT/conf/logback-loggers.xml" 
optional="true"/>
   <include resource="logback-loggers.xml" optional="true"/>
</configuration>

--

Philippe Busque
1111, rue St-Charles Ouest,
Tour Est, bureau 255
Longueuil (Québec) Canada J4K 5G4
Tél. : 450-449-0102 ext. 3017
Télec. : 450-449-8725

Ce message et les fichiers d’accompagnement transmis avec celui-ci s’adressent 
expressément au(x) destinataire(s) et peuvent contenir des renseignements 
confidentiels et privilégiés. Si vous recevez ce message par erreur, veuillez 
en aviser immédiatement l’expéditeur par courrier électronique. Veuillez 
également ne pas en prendre connaissance et en supprimer toutes les copies 
immédiatement. Technologies Interactives Mediagrif Inc. et ses filiales 
n’acceptent aucune responsabilité à l’égard des opinions exprimées dans le 
message ou des conséquences de tout virus informatique qui pourrait être 
transmis avec ce message. Ce message fait également l’objet d’un copyright. Il 
est interdit d’en reproduire, adapter ou transmettre quelque partie que ce soit 
sans le consentement écrit du détenteur du copyright.

This email and any files transmitted with it are solely intended for the use of 
the addressee(s) and may contain information that is confidential and 
privileged. If you receive this email in error, please advise us by return 
email immediately. Please also disregard the contents of the email, delete it 
and destroy any copies immediately. Mediagrif Interactive Technologies Inc. and 
its subsidiaries do not accept liability for the views expressed in the email 
or for the consequences of any computer viruses that may be transmitted with 
this email. This email is also subject to copyright. No part of it should be 
reproduced, adapted or transmitted without the written consent of the copyright 
owner.
_______________________________________________
logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to