OSGI下的Log4j(Eclipse RCP) [英] Log4j under OSGI (Eclipse RCP)

查看:366
本文介绍了OSGI下的Log4j(Eclipse RCP)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我不会直接使用Log4j,但是我需要第三方插件来记录它。



我做了一个简单的JAVA项目,一切都很好,但是在PLUGIN开发没有任何作用。



我的Classpath中有log4j jar,甚至尝试使用符合OSGI的Log4j的Spring存储库,并将其包含在Dependencies中。没有任何工作。



我已经尝试了一些没有成功的方法:
http://swik.net/Eclipse/Planet+Eclipse/Raja+Kannappan:+Eclipse + RCP + - +转换+依赖关系+到+ OSGi +捆绑/ drqpf



并不能完全理解这一个:
http://www.eclipsezone.com/eclipse/forums/t99588.html



任何人都可以指向正确的方向?



谢谢。

解决方案

您只需使用中的log4j.properties文件创建log4j片段包。



更新:要查找的东西:




  • 标题名称应为: Fragment-Host:log4j

  • log4j.properties 应该在
    src 文件夹中。

  • 所有使用log4j的软件包应在
    import-Package 属性 org.apache.log4j / li>

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.

解决方案

You simply have to create log4j fragment bundle with the log4j.properties file inside.

UPDATE: Some things to look for:

  • Header name should be: Fragment-Host: log4j.
  • log4j.properties should be in the src folder.
  • All the bundles which use log4j should have org.apache.log4j in their Import-Package attribute

这篇关于OSGI下的Log4j(Eclipse RCP)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆