使用 log4j 记录不需要的依赖项
我正在使用一个名为 JarClassLoader (JCL) 的项目,它允许我从 InputStream 加载 jar。这非常有帮助,但我发现 JarClassLoader 会留下一个 log4j.xml 文件并在运行时加载该文件。我使用 slf4j 来记录日志语句,并使用 log4j 来记录我的项目。以下是 JCL log4j.xml 文件的链接: http://code.google.com/p/jcloader/source/browse/trunk/JCL2/src/main/resources/org/xeustechnologies/jcl/logging/log4j.xml?r=142< /a> 我想完全忽略这一点,因为我有自己的日志记录设置。关于如何阻止加载此文件的任何想法?或者如何在加载 JCL 日志记录后将其删除。 或者,如果除了 JCL 之外还有其他东西可以读取 InputSteam 并从流中获取 jar 文件。 提前致谢。
I'm using a project call JarClassLoader (JCL) which allows me to load a jar from an InputStream. This is very helpful, but I've found that the JarClassLoader leaves an log4j.xml file and loads that file at runtime. I'm using slf4j for my logging statements, and also using log4j for logging in my project. Here is a link to the JCL log4j.xml file:
http://code.google.com/p/jcloader/source/browse/trunk/JCL2/src/main/resources/org/xeustechnologies/jcl/logging/log4j.xml?r=142
I would like to ignore this completely, as I have my own logging setup. Any ideas on how I can prevent this file from being loaded? Or how I can remove JCL logging after it's loaded.
Or, if there is something else other than JCL that can read a InputSteam and grab the jar file out of the stream.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
实际上,将
log4j.xml
(或任何其他日志配置文件)与旨在与其他项目链接的库一起提供是错误的。结果正是您现在遇到的问题。我会为此发布一份错误报告,并使用不含 log4j.xml 的 jar 文件的私有副本,直到它被修复。Actually, it's a mistake to ship
log4j.xml
(or any other logging configuration file) with a library that is intended to be linked with other projects. It results with exactly the problem you have now. I'd issue a bug report for that and use a private copy of the jar file without log4j.xml, until it is fixed.