如何沙箱 SLF4J

发布于 12-08 14:08 字数 906 浏览 0 评论 0原文

我有一个应用程序(扩展)在 Smartfox 服务器内运行。大多数人都不知道 Smartfox,但其设置与 Tomcat 类似。即扩展有自己的类加载器,它首先从扩展加载类,然后加载全局服务器库(我将其称为“自私类加载”,因为我不知道官方术语(如果有的话)。

我有多个 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]

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

(参见 是否有一个类似 Tomcat 的类加载器可以独立使用吗? 获取自私类加载器的源代码)

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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

澜川若宁2024-12-15 14:08:04

SLF4J 发出的输出只是一个警告。从您描述的类加载(自私/叶子优先/本地优先)来看,SLF4J 可能与 logback 绑定。你检查了吗?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文