开发者

How to sandbox SLF4J

开发者 https://www.devze.com 2023-04-11 17:04 出处:网络
I have a an application (extension) running inside a Smartfox server. Most of you won\'t know Smartfox, but the setup is like Tomcat. i.e. the extension has its own classloader which loads classes fro

I have a an application (extension) running inside a Smartfox server. Most of you won't know Smartfox, but the setup is like Tomcat. i.e. the extension has its own classloader which loads classes from the extension first, the global server libs after (I will call this selfish classloading, since I don't know the official term, if any exists).

I 开发者_开发技巧have a multiple SLF4J bindings problem, with my extension containing logback and the server containing another slf4j binding (that is useless to me):

INFO   | jvm 1    | 2011/10/06 11:10:25 | SLF4J: Class path contains multiple SLF4J bindings.
INFO   | jvm 1    | 2011/10/06 11:10:25 | SLF4J: Found binding in [jar:file:/opt/smartfox/Server/lib/lsc.jar!/org/slf4j/impl/StaticLoggerBinder.class]
INFO   | jvm 1    | 2011/10/06 11:10:25 | SLF4J: Found binding in [jar:file:/opt/smartfox/Server/wext/smilefish/logback-classic-jar-logback-classic-0.9.29.jar!/org/slf4j/impl/StaticLoggerBinder.class]

I was hoping that the selfish classloading would fix this kind of problem, but apparently it doesn't. How can I fix this without removing either binding?

(See Is there a Tomcat-like classloader that can be used standalone? for the source code of the selfish classloader)


The output emitted by SLF4J is just a warning. From the class loading you describe (selfish/leaf-first/local-first), SLF4J has probably bound with logback. Did you check?

0

精彩评论

暂无评论...
验证码 换一张
取 消