Logging pax日志是否支持标准osgi日志服务api
我在我的osgi运行时和测试标准osgi日志服务上配置了pax日志记录,但没有记录日志记录。不管怎么说,所有其他日志API似乎都像[2]预期的那样工作。我错过什么了吗Logging pax日志是否支持标准osgi日志服务api,logging,osgi,pax,Logging,Osgi,Pax,我在我的osgi运行时和测试标准osgi日志服务上配置了pax日志记录,但没有记录日志记录。不管怎么说,所有其他日志API似乎都像[2]预期的那样工作。我错过什么了吗 LogService logService; public void start(BundleContext bundleContext) throws Exception { ServiceReference ref = bundleContext.getServiceReference(LogService.cla
LogService logService;
public void start(BundleContext bundleContext) throws Exception {
ServiceReference ref = bundleContext.getServiceReference(LogService.class.getName());
if (ref != null)
{
logService = (LogService) bundleContext.getService(ref);
logService.log(LogService.LOG_INFO, " ----------- Testing OSGI logging on bundle start -------------------- ");
}
[1]
[2]
谢谢这是OSGi的一个典型错误:您希望LogService在启动时可用。如果它被延迟,您将得到一个
null
引用,而不记录任何内容
尝试在服务发布时使用标准的注入方法,如
可以找到一个好的教程