を動作を停止しますTomcatの起動時にグローバルリソースとして必要なクラスが含まれているためです。それはslf4jにログを書き込むので、slf4jとlogback jarも必要です。 JoranConfiguratorを使用してmyStateLogback.xmlをロードします。私は私の「複数のSLF4Jバインディング」がログに警告を取り除く場合は、私はTomcatの6に次のディレクトリ構造を持っている
myApp webappはCommons-Loggingにログを書き込みますが、slf4jへのログをすべて移動する準備としてslf4jからlogbackに移動したいので、jcl-over-slf4jブリッジを使用しています。上記の設定で
、ログすべての作品が、私は、起動時に次の警告が出ます:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/tomcat/lib/logback-classic-0.9.29.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/tomcat/webapps/myApp/WEB-INF/lib/logback-classic-0.9.29.jar!/org/slf4j/impl/StaticLoggerBinder.class]
私はWebアプリケーションのlibディレクトリの外にlogback-古典取る場合、私は次の例外を取得:
をException in thread "Timer-30" java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:284)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:252)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:156)
at org.apache.commons.logging.impl.SLF4JLogFactory.getInstance(SLF4JLogFactory.java:132)
at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:272)
私はWebアプリケーションのlibディレクトリから2 logback jarファイルを削除し、SLF4J-api.jarの場合、私は警告や例外なく何を取得していないが、私のWebアプリケーションからのログがmyStateLogback.xmlファイルによってピックアップされています私が欲しくないロガーです。私は望んでいないステートメントを除外することができますが、webappとjarの設定ファイルを別にしたいと思います。これを達成する方法はありますか?
私はtomcat 6.0.23、logback 0.9.29、slf4j 1.6.3を使用しています。
おかげで、 サラ
非常に興味深いと私はこの状況で動作すると思います。しかし、単純にするために、私たちはmyState.jarのtomcat juliロギングを使用し、それぞれのwebappにlogback/slf4j jarsを置いて独自のロギングを制御することに決めました。 – ssloan