为Karaf和Pax日志记录添加自定义log4j2附加程序 [英] Add custom log4j2 appender for Karaf and Pax Logging

查看:180
本文介绍了为Karaf和Pax日志记录添加自定义log4j2附加程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试添加新的自定义log4j2附加程序. Karaf 3.0.2使用不支持log4j2的pax-logging 1.7.4.我有一个扩展程序,扩展了 org.apache.logging.log4j.core.appender.AbstractAppender .

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.

我跟着此博客 http://blog.nanthrax.net/2012/12/create-custom-log4j-appender-for-karaf-and-pax-logging/由Jean-Baptiste撰写.因为我的追加程序是用log4j2编写的,所以它不起作用.

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.

有什么其他选择,以便karaf也可以使用此附加程序记录日志?

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

推荐答案

答案已经存在于您的问题中,它不起作用,应该怎么做. Karaf的3.0.2版本确实使用Pax Logging 1.7.x,但不支持Log4j2. 因此,您只是无法为log4j2注册自定义附加程序,无法创建Log4j附加程序并将其添加到您的配置中.
或升级到使用Pax Logging 1.8.x的Karaf 3.0.3,现在也支持Log4j2.可能想尝试一下.

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.

这篇关于为Karaf和Pax日志记录添加自定义log4j2附加程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆