我可以让Log4j显示来自Spring类(特别是Spring Security)的日志记录吗?

问题描述 投票:0回答:1

我有一个使用Spring Security 3.2的Spring MVC Web应用程序。

它被配置为对MySQL数据库进行用户认证,但用户无法登录。 我怀疑Spring Security没有连接到MySQL数据库,但没有显示任何日志消息。

我应该在我的log4j.properties文件中添加什么来使Spring Security日志显示?

我试着在文件中添加以下内容......

log4j.category.org.springframework=DEBUG

但是没有用。 这是我当前的log4j.properties文件......。

status = error
name = PropertiesConfig

filters = threshold

filter.threshold.type = ThresholdFilter
filter.threshold.level = debug

appenders = console

appender.console.type = Console
appender.console.name = STDOUT
appender.console.layout.type = PatternLayout
appender.console.layout.pattern = %d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

rootLogger.level = info
rootLogger.appenderRefs = stdout
rootLogger.appenderRef.stdout.ref = STDOUT

log4j.category.org.springframework=DEBUG <<<--- adding this didn't work

任何想法?

spring spring-security log4j log4j2
1个回答
0
投票

试试这个 :)

log4j.logger.org.springframework=DEBUG

© www.soinside.com 2019 - 2024. All rights reserved.