自定义appender OSGI Pax日志记录显示错误

时间:2015-04-07 16:33:53

标签: logging log4j rollingfileappender pax

我的要求是创建我自己的Log appender来执行我的日志记录,因此引用了有趣的博客

http://notizblog.nierbeck.de/2011/08/adding-custom-log-appender-to-pax-logging/

并创建了我自己的appender并执行了servicemix(karaf)中的所有步骤。

启动servicemix时,我会收到以下错误。

Please wait while Apache ServiceMix is starting...
  3% [==>                                                                     ]log4j:ERROR Could not instantiate class [org.ops4j.pax.logging.extender.ZipRollingFileAp
java.lang.ClassNotFoundException: org.ops4j.pax.logging.extender.ZipRollingFileAppender not found by org.ops4j.pax.logging.pax-logging-service [3]
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1556)
        at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1993)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at org.apache.log4j.helpers.Loader.loadClass(Loader.java:198)
        at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:326)
        at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:123)
        at org.apache.log4j.PaxLoggingConfigurator.parseAppender(PaxLoggingConfigurator.java:97)
        at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:735)
        at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:615)
        at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:502)
        at org.apache.log4j.PaxLoggingConfigurator.doConfigure(PaxLoggingConfigurator.java:72)
        at org.ops4j.pax.logging.service.internal.PaxLoggingServiceImpl.updated(PaxLoggingServiceImpl.java:214)
        at org.ops4j.pax.logging.service.internal.PaxLoggingServiceImpl$1ManagedPaxLoggingService.updated(PaxLoggingServiceImpl.java:362)
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.updateService(ManagedServiceTracker.java:148)
        at org.apache.felix.cm.impl.helper.ManagedServiceTracker.provideConfiguration(ManagedServiceTracker.java:81)
        at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.provide(ConfigurationManager.java:1448)
        at org.apache.felix.cm.impl.ConfigurationManager$ManagedServiceUpdate.run(ConfigurationManager.java:1404)
        at org.apache.felix.cm.impl.UpdateThread.run(UpdateThread.java:103)
        at java.lang.Thread.run(Thread.java:662)
log4j:ERROR Could not instantiate appender named "out".
100% [========================================================================]

有人可以帮我吗???

1 个答案:

答案 0 :(得分:1)

如果您发现错误:log4j:ERROR无法实例化名为“out”的appender。 验证org.ops4j.pax.logging.cfg是否正确写入。