简体   繁体   English

Karaf如何从日志中排除指定的包

[英]Karaf how to exclude specified bundle from log

I would like to exclude my bundle from root karaf log. 我想从根karaf日志中排除我的捆绑包。 The JSON sended by this bundle is too large, and the log is no more readeable. 此捆绑包发送的JSON太大,并且日志不再可读。

I suppose that I should change osgi:* in line : 我想我应该在行中更改osgi:*:

rootLogger=INFO,out,osgi:*

Which value I should put there ? 我应该在那值?


Edit, the problem is more complicated that I thought. 编辑,问题比我想的还要复杂。

The JSON sont injected in logs by org.apache.cxf.cxf-rt-features-logging. org.apache.cxf.cxf-rt-features-logging在日志中注入了JSON注释。 It is used also by other bundle. 其他捆绑包也使用它。 I vould like remove only JSON sending and receiving by my bundle. 我想只删除我的捆绑包发送和接收的JSON。

How can I do this ? 我怎样才能做到这一点 ?

If you want to exclude a specific bundle from logging, just turn off logging for the bundle within the pax logging config. 如果要从日志记录中排除特定捆绑软件,只需在pax日志记录配置中关闭捆绑软件的日志记录即可。

log4j.logger.mybundle = OFF

If you want to fine tune CXF message logging please check http://cxf.apache.org/docs/message-logging.html . 如果您想微调CXF消息日志记录,请查看http://cxf.apache.org/docs/message-logging.html

Some things to note: 注意事项:

The logger name is .. karaf by default only cuts it to just the type. 记录器名称默认为.. karaf,仅将其剪切为该类型。 A lot of the details are in the MDC values You need to change your pax logging config to make these visible. MDC值中包含许多详细信息,您需要更改pax日志记录配置以使其可见。

You can use the logger name to fine tune which services you want to log this way. 您可以使用记录器名称来微调您要以这种方式记录的服务。 For example set the debug level to WARN for noisy services to avoid that they are logged or log some services to another file. 例如,将嘈杂的服务的调试级别设置为WARN,以避免它们被记录或将某些服务记录到另一个文件中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM