【问题标题】:Unable to get Spring Framework Debug messages logged无法记录 Spring Framework Debug 消息
【发布时间】:2016-08-09 04:25:46
【问题描述】:

我正在使用 Spring 4.3.1 安全性。我已包含以下日志记录依赖项。

1)。 log4j-1.2.17.jar 2).commons-logging-1.2.jar

log4j.properties 文件中,我包含了以下内容。

log4j.category.org.springframework.beans.factory=DEBUG log4j.category.org.springframework.security=DEBUG

我没有收到 Logger 记录的任何 Spring Debug 消息。我正在正确记录我创建的所有消息。

请指出我哪里出错了。

【问题讨论】:

  • 你的 log4j.properties 文件的路径是什么?
  • Ashish,log4j.properties 文件存在于类路径中。我正在正确记录我自己的消息,所以我相信 Log4j 的设置很好。
  • 请查看此链接 mkyong.com/spring-mvc/spring-mvc-log4j-integration-example 获取 spring mvc 和 tutorialspoint.com/spring/logging_with_log4j.htm 获取 java 应用程序。
  • Ranjit,我已经阅读了这些帖子。正如我所说,日志记录设置正确。我自己的消息正在被记录,但 Spring Framework 内部消息没有。

标签: spring spring-mvc logging spring-security log4j


【解决方案1】:

我认为你应该使用 logger 而不是 category

log4j.logger.org.springframework.beans.factory=DEBUG
log4j.logger.org.springframework.security=DEBUG

Logger 在 Log4J 的早期版本中被称为“类别”。

【讨论】:

  • 不幸的是,它没有帮助。
【解决方案2】:

问题的根本原因在于使用 Websphere 作为 Web 服务器。这些设置在 Tomcat 上运行良好,我能够看到所有日志。

显然,Websphere 中内置的 Commons-Logging 实现优先于部署在 Websphere 上的任何应用程序提供的实现。我无法找到解决此限制的解决方案/解决方法。

【讨论】:

    猜你喜欢
    • 2015-07-10
    • 2019-11-21
    • 2014-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多