Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log4j2 warning #12332

Closed
wants to merge 6 commits into from
Closed

Log4j2 warning #12332

wants to merge 6 commits into from

Conversation

zt9788
Copy link
Contributor

@zt9788 zt9788 commented Jul 10, 2024

fixed #12102

2024-05-15T09:51:31.358800400Z main WARN The use of package scanning to locate plugins is deprecated and will be 

@zt9788 zt9788 changed the title Log4j warning Log4j2 warning Jul 10, 2024
Copy link
Collaborator

@KomachiSion KomachiSion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two question:

  1. Can this change support log4j2 load property from nacosClientProperty?
  2. From which version log4j2 support this configuration?

@zt9788
Copy link
Contributor Author

zt9788 commented Jul 10, 2024

两个问题:

  1. 这个更改可以支持从 nacosClientProperty 加载 log4j2 属性吗?
  2. log4j2从哪个版本开始支持这种配置?
  1. 采用单类和xml覆盖本地方式, 测试-DJM.LOG.PATH=xxx 或跟其他属性,可以正确获得
  2. 应该是v2.1 显式加载插件 (https://logging.apache.org/log4j/) 不过官网404了... 等一会我在看看别记错了

@zt9788
Copy link
Contributor Author

zt9788 commented Jul 10, 2024

两个问题:

  1. 这个更改可以支持从 nacosClientProperty 加载 log4j2 属性吗?
  2. log4j2从哪个版本开始支持这种配置?
  1. 采用单类和xml覆盖本地方式, 测试-DJM.LOG.PATH=xxx 或跟其他属性,可以正确获得
  2. 应该是v2.1 显式加载插件 (https://logging.apache.org/log4j/) 不过官网404了... 等一会我在看看别记错了

细看了一下, https://logging.apache.org/log4j/2.x/manual/configuration.html#ConfigurationSyntax Package标签在3.0 也废弃了
短期目前这个方式可以先去除警告.
其他方式是采用org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor 来处理,不过这块我在看看
@KomachiSion 你看这个版本作为过渡要不要处理,如果不处理,就先关闭,等我找时间本地测一下PluginProcessor没问题,我在发也行.

@KomachiSion
Copy link
Collaborator

两个问题:

  1. 这个更改可以支持从 nacosClientProperty 加载 log4j2 属性吗?
  2. log4j2从哪个版本开始支持这种配置?
  1. 采用单类和xml覆盖本地方式, 测试-DJM.LOG.PATH=xxx 或跟其他属性,可以正确获得
  2. 应该是v2.1 显式加载插件 (https://logging.apache.org/log4j/) 不过官网404了... 等一会我在看看别记错了

细看了一下, https://logging.apache.org/log4j/2.x/manual/configuration.html#ConfigurationSyntax Package标签在3.0 也废弃了 短期目前这个方式可以先去除警告. 其他方式是采用org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor 来处理,不过这块我在看看 @KomachiSion 你看这个版本作为过渡要不要处理,如果不处理,就先关闭,等我找时间本地测一下PluginProcessor没问题,我在发也行.

如果当前的方法能够覆盖当前绝大多数log4j2的版本,应该要先合入, 主要是担心这么修改后, 导致很多版本无法使用。

虽然现在的用法有warning,但是是可用的。

至于新方法,我觉得可能需要新增一个log4j2的adapter来适配,我理解新的这种处理方式,很多旧版本不支持。

目前PR先聚焦于前者, 帮忙确认一下修改后的配置,在log4j2的适配版本范围, 比如2.1~latest,或者2.0~latest;再考虑是否合入。

@zt9788
Copy link
Contributor Author

zt9788 commented Jul 15, 2024

好的,我本地再确认确认, 暂时这个pr我先关闭,等我确认没问题,我在重新打开

@zt9788 zt9788 closed this Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log4j2 升级到 2.23.1版本后,Nacos 会导致 Log4j2 日志输出异常
2 participants