OSGI 下的 Log4j (Eclipse RCP)
经过多次测试,我得出的结论是 Log4j 无法在 OSGI 下工作。
我不直接使用 Log4j,但我需要第三方插件来使用它进行日志记录。
我做了一个普通的JAVA项目,一切都很好,但在插件开发下没有任何效果。
我的类路径中有log4j jar,甚至尝试了一个Spring存储库OSGI兼容的Log4j并将其包含在依赖项下。什么都不起作用。
我尝试过一些方法但没有成功: http:// /swik.net/Eclipse/Planet+Eclipse/Raja+Kannappan:+Eclipse+RCP+-+Converting+Dependencies+to+OSGi+Bundles/drqpf
无法完全理解这一点: http://www.eclipsezone.com/eclipse/forums/t99588.html
有人能指出我正确的方向吗?
谢谢。
After many tests i concluded that the Log4j is not working under OSGI.
I do not use Log4j directly, but i need third party plugins to log with it.
I made a plain JAVA project and everything works great, but under PLUGIN development nothing works.
I have log4j jar in my Classpath and even tried a Spring repository OSGI compliant Log4j and included it under Dependencies. Nothing works.
I've tried this some approach with no success:
http://swik.net/Eclipse/Planet+Eclipse/Raja+Kannappan:+Eclipse+RCP+-+Converting+Dependencies+to+OSGi+Bundles/drqpf
and could not fully understand this one:
http://www.eclipsezone.com/eclipse/forums/t99588.html
Can anyone point me on the right direction?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您只需创建包含 log4j.properties 文件的 log4j 片段包。
更新:需要查找的一些内容:
Fragment-Host: log4j
。src 文件夹。
org.apache.log4j
他们的
Import-Package
属性You simply have to create log4j fragment bundle with the log4j.properties file inside.
UPDATE: Some things to look for:
Fragment-Host: log4j
.src folder.
org.apache.log4j
intheir
Import-Package
attribute要登录 OSGi,您应该查看 OSGi 日志服务。这是很好地解释了一个好方法的文章: http://blog.kornr.net/index.php/2008/12/18/osgi-logging-putting-it-all-together
您还可以查看 Pax-Logging: http://wiki.ops4j.org/display/paxlogging/Pax+Logging
For logging in OSGi, you should take a look at OSGi Log Service. Here is article that explains quite well a good approach: http://blog.kornr.net/index.php/2008/12/18/osgi-logging-putting-it-all-together
You can also take a look at Pax-Logging: http://wiki.ops4j.org/display/paxlogging/Pax+Logging