How to make Pax logging to use the loggback config instead of the standard log4j properties like syntax

心已入冬 提交于 2019-12-20 06:05:32

问题


I have some services in tomcat and trying to move to apache karaf.

I have a existing service which uses logback for logging configuration.

I tried to make same configuration in osgi, but could not achieve. Any please let me know what could be the problem?

  org.ops4j.pax.logging.cfg
         org.ops4j.pax.logging.logback.config.file=${karaf.home}/etc/logback.xml

logback.xml is available at ${karaf.home}/etc/ --.

Apache Karaf version : 3.0 , pax logging 1.7.1 which is packaged with karaf from build.

After above configuration change, my karaf.log contents are :

   Jul 02, 2014 4:21:32 PM org.apache.karaf.main.lock.SimpleFileLock lock
   .....................................................................
   INFO: Lock acquired
   Jul 02, 2014 4:21:32 PM org.apache.karaf.main.Main$KarafLockCallback lockAquired
   INFO: Lock acquired. Setting startlevel to 100

回答1:


The logback backend of Pax Logging is in a separate bundle mvn:org.ops4j.pax.logging/pax-logging-logback/1.7.1 which is not part of Karaf.

So if you didn't install this bundle manually, then it's no surprise that your logback.xml gets ignored.



来源:https://stackoverflow.com/questions/24529660/how-to-make-pax-logging-to-use-the-loggback-config-instead-of-the-standard-log4j

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!