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

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

问题描述

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

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 撰写.它不起作用,因为我的 appender 是用 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 也使用这个 appender 进行日志记录?

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

推荐答案

答案已经在您的问题中,它不起作用,以及它是如何起作用的.Karaf 3.0.2 版确实使用了不支持 Log4j2 的 Pax Logging 1.7.x.因此,您无法为 log4j2 注册自定义附加程序,创建一个 Log4j 附加程序并将其添加到您的配置中.
或者升级到 Karaf 3.0.3,它使用现在也支持 Log4j2 的 Pax Logging 1.8.x.可能想试试那个.

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 appender的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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