Spring-Jboss: 开启安全调试

Spring-Jboss: Security debugging is enabled

我在 Jboss (7.1.3) 上有一个 Spring (4.1.7) MVC 应用程序 运行。 在 server.log 中,我有以下消息

16:06:21,564 WARN  [org.springframework.security.config.debug.SecurityDebugBeanFactoryPostProcessor] (MSC service thread 1-7) 

********************************************************************
**********        Security debugging is enabled.       *************
**********    This may include sensitive information.  *************
**********      Do not use in a production system!     *************
********************************************************************

我想将 spring 安全的日志级别更改为 INFO。 我在 log4j.properties

中尝试了这两行
    log4j.category.org.springframework.security = INFO
    log4j.logger.org.springframework.security=INFO

但其中 none 有效。

我还通过添加这些行修改了 Jboss (standalone.xml) 的配置

<logger category="org.springframework.security">
    <level name="INFO"/>
</logger>

但该消息仍出现在服务器日志中。 你能告诉我如何更改 spring 的日志级别吗?谢谢

这是因为这是一条警告信息。如果您将级别设置为 INFO,它将打印 INFO 和更高级别。

如果您不想看到该特定消息,您可以为 org.springframework.security.config.debug.SecurityDebugBeanFactoryPostProcessor 添加一个类别并将其设置为 ERROR。不过,我不确定您还错过了哪些其他消息。