停止从依赖项显示记录器输出到控制台 [英] Stop displaying logger output to console from dependencies

查看:47
本文介绍了停止从依赖项显示记录器输出到控制台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是log4j的新手,因此向SO寻求帮助.

I am new to log4j hence asking SOs help.

在我的Java项目中,我有几个Maven依赖关系,这些依赖关系使控制台输出中带有多余的日志信息.我想禁用此类日志记录.

In my Java project I have couple of Maven dependencies which clutter the console output with redundant log info. I want to disable such logging.

我知道将 additivity 属性设置为 false 可能会有所帮助.但是无法正确使用它.

I understand setting additivity property to false might help. But could not use it properly.

我正在寻找一个 log4j.xml 配置,该配置将仅打印我项目中的日志输出(警告,错误..),而不显示任何依赖项.

I am looking for a log4j.xml config which will only print log output (warn, error ..) from my project and not from any dependencies.

推荐答案

log4j2.xml 似乎覆盖了所有其他配置.截至目前,我已经关闭了该依赖关系.也许 log4j2>log4j 因此出现了问题.也是 xml>属性,就像我在某处看到的一样.

It looks like the log4j2.xml was overriding all other config. As of now I have switched that dependency off. Maybe log4j2 > log4j hence the issue. Also xml > properties as I have seen somewhere.

这篇关于停止从依赖项显示记录器输出到控制台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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