【问题标题】:How to sandbox SLF4J如何沙箱 SLF4J
【发布时间】:2011-10-06 09:25:05
【问题描述】:

我有一个在 Smartfox 服务器内运行的应用程序(扩展程序)。你们中的大多数人不会知道 Smartfox,但它的设置就像 Tomcat。即扩展有它自己的类加载器,它首先从扩展加载类,然后是全局服务器库(我将称之为selfish classloading,因为我不知道官方术语,如果存在的话)。

我有多个 SLF4J 绑定问题,我的扩展包含 logback,而服务器包含另一个 slf4j 绑定(这对我来说没用):

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]

我希望自私的类加载能解决这类问题,但显然它没有。如何在不删除任何绑定的情况下解决此问题?

(自私类加载器的源代码见Is there a Tomcat-like classloader that can be used standalone?

【问题讨论】:

    标签: java classloader slf4j logback


    【解决方案1】:

    SLF4J 发出的输出只是一个警告。从您描述的类加载(selfish/leaf-first/local-first)来看,SLF4J 可能与 logback 绑定。你检查了吗?

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-28
      • 2010-12-15
      • 2021-07-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-25
      相关资源
      最近更新 更多