如何通过我的log4j配置禁用jose4j日志信息?[英] How do I disable jose4j log messages through my log4j config?

本文是小编为大家收集整理的关于如何通过我的log4j配置禁用jose4j日志信息?的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

我正在使用 jose4j 在我正在工作的Java应用程序中.这是一个JSON Web令牌库,我发现将软件包名称放入我的Log4j配置文件中无助于我从此内容中看到的(许多)调试日志记录消息.这是我相关的log4j配置部分

<Root level="debug">
    <AppenderRef ref="Console"></AppenderRef>
</Root>
<Logger name="org.jose4j" level="warn" additivity="false">
    <AppenderRef ref="Console"></AppenderRef>
</Logger>

所以,我本质上只想在Jose4j上升到警告水平(或更可怕)时从Jose4j中看到日志消息.

我能够收集的几件事.

  • 将root Logger设置为"信息"确实使Jose4J调试消息消失了,因此Jose4J的Logger至少知道我的记录设置.

  • It looks like the logger that jose4j uses is org.sl4j

  • 我有一个类似的问题昨天.似乎添加了一些罐子可以解决这个问题,但我对此没有运气.

我还添加了这个jar classpath ...这也没有起作用.

有人知道我如何让这个库与我的记录设置一起工作?

推荐答案

两个点:

本文地址:https://www.itbaoku.cn/post/1575152.html

问题描述

I am using jose4j in a java application that I am working on. It is a json web token library, and I've found that putting the package name inside my log4j config file does nothing to quiet the (many) debug logging messages that I am seeing from this thing. Here's my relevant log4j config section

<Root level="debug">
    <AppenderRef ref="Console"></AppenderRef>
</Root>
<Logger name="org.jose4j" level="warn" additivity="false">
    <AppenderRef ref="Console"></AppenderRef>
</Logger>

So, I essentially only want to see log messages from jose4j when they rise to the level of warn (or more dire).

A few things I have been able to gather.

  • Setting the root logger to "info" does make the jose4j debug messages go away, so jose4j's logger at least knows about my logging setup.

  • It looks like the logger that jose4j uses is org.sl4j

  • I had a similar issue yesterday. It seemed like adding a few jars did the trick to fix that issue, but I'm not having luck with this.

I also added this jar to the classpath... this also did not work.

Does anyone know how I can get this library to work with my logging setup?

推荐答案

Two points: