使用 spring-DM 扩展器进行 OSGi 日志记录不进行日志记录
我的设置:我能够使用 Log4J 作为我的日志记录框架创建一个简单的 OSGi 捆绑包,当部署到我的 OSGi 容器(Equinox)时,它工作得很好,我的日志记录配置非常简单,使用一个单独的捆绑包片段配置我的日志记录。该设置不涉及弹簧,而且效果非常好。
我的问题:我正在将一个使用 log4j 作为日志框架的 Spring 应用程序转换为 OSGi,第一阶段是为我的 Spring 应用程序创建各种捆绑包,现在我已经完成了。我遇到的问题是,与非 Spring 应用程序一起使用的 OSGi 日志片段包没有配置我的启用了 spring 的包。
我知道捆绑包处于活动状态,因为 system.out.println 确实有效,但是我的所有日志记录配置都不起作用。我在控制台中看不到任何内容,我确实看到很多 spring 输出,确认我的捆绑服务已公开,但没有日志记录。
任何建议表示赞赏。
My Setup: I am able to create a simple OSGi bundle with Log4J as my logging framework and when deployed to my OSGi container (Equinox) it works great my logging is configured very simply with a seperate bundle fragment that configures my logging. This setup does not have spring involved and it works really nicely.
My Issue: I am converting over a spring application which uses log4j as its logging framework to OSGi, the first stage was creating various bundles for my spring application which I have now completed. The problem I have is that the OSGi logging fragment bundle that worked with the non spring applications does not configure my spring enabled bundles.
I know the bundles are active as system.out.println does work however all my logging configuration is not working. I can see nothing in the console I do see a lot of spring output confirming my bundles services are exposed but no logging.
Any suggestions appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我现在已经解决了这个问题,它花了我一天的时间,所以我希望有一天它能帮助别人。
我找到了文章 如何使用 Pax登录我的包,它提到确保我在 MANIFEST 中使用了以下内容。
此代码确保日志记录的提供者是 paxlogging。
没有它,我永远无法看到任何日志消息,现在我可以,这是很棒的配置,这似乎不适用于片段,所以我正在研究 ConfAdmin 为此,但现在我很高兴,可以通过适当的日志记录继续开发。
I have this now fixed, its has taken me the guts of a day so I hope it helps someone some day.
I found the article How to use Pax Logging in my bundles and it mentioned to make sure I used the following in my MANIFEST
This code makes sure that the provider for the logging is paxlogging.
Without it I never was able to see any of my logging messages now I can which is great configuring this does not seem to work with fragments so I am looking into ConfAdmin for this but for now I am happy and can continue development with proper logging.