相关疑难解决方法(0)

Spring Security身份验证日志记录

我正在使用Spring Security 3.1来验证网站的用户.当登录失败,因为spring安全性无法连接到数据库时,我在日志中收到以下语句:

2012-07-12 11:42:45,419 [ajp-bio-8009-exec-1] DEBUG      org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter - Authentication request failed: org.springframework.security.authentication.AuthenticationServiceException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Connections could not be acquired from the underlying database!
Run Code Online (Sandbox Code Playgroud)

我的问题是,为什么这是一个DEBUG语句而不是ERROR?我必须浏览大量的调试语句才能找到实际的错误.

编辑

这是我的身份验证管理器:

<bean id="securityDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="java:comp/env/securityDS"/>
    <property name="resourceRef" value="true"/>
</bean>

<bean id="encoder" class="org.springframework.security.crypto.password.StandardPasswordEncoder" />

<security:authentication-manager>
    <security:authentication-provider>
        <security:password-encoder ref="encoder" />
        <security:jdbc-user-service 
            data-source-ref="securityDataSource"
            authorities-by-username-query="SELECT username, authority FROM login WHERE username = ?"
            users-by-username-query="SELECT username, password, enabled FROM login WHERE username = ?"
        />        
    </security:authentication-provider>
</security:authentication-manager>
Run Code Online (Sandbox Code Playgroud)

logging spring log4j spring-security

4
推荐指数
2
解决办法
2万
查看次数

标签 统计

log4j ×1

logging ×1

spring ×1

spring-security ×1