Add custom log4j2 appender for Karaf and Pax Logging

妖精的绣舞 提交于 2019-12-12 23:15:53

问题


I am trying to add new custom log4j2 appender. Karaf 3.0.2 use pax-logging 1.7.4 which does not support log4j2. I have a appender which extend org.apache.logging.log4j.core.appender.AbstractAppender.

I followed this blog http://blog.nanthrax.net/2012/12/create-custom-log4j-appender-for-karaf-and-pax-logging/ writen by Jean-Baptiste. It will not work because my appender is written in log4j2.

What are the alternatives so that karaf also log using this appender?


回答1:


The answer is already in your question it doesn't work, and how is it supposed to. Version 3.0.2 of Karaf does use Pax Logging 1.7.x wich doesn't support Log4j2. So you just can't register a custom appender for log4j2, create a Log4j appender and add that to your configuration.
Or upgrade to Karaf 3.0.3 which uses Pax Logging 1.8.x which now also support Log4j2. Might want to try that.



来源:https://stackoverflow.com/questions/28232220/add-custom-log4j2-appender-for-karaf-and-pax-logging

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