如何在Grails 2.2.3中为Spring Security启用日志记录?

mu0hgdu0  于 2023-05-29  发布在  Spring
关注(0)|答案(1)|浏览(155)

如何在grails 2.2.3中为Spring Security启用日志记录?
我想看看 Spring 安全的完整日志。我尝试在onAuthenticationFailure方法上处理它,但没有成功

public void onAuthenticationFailure(final HttpServletRequest request, final HttpServletResponse response,
            final AuthenticationException exception) throws IOException, ServletException {

        ObjectMapper objectMapper = new ObjectMapper();

        if (SpringSecurityUtils.isAjax(request)) {
            saveException(request, exception);
            getRedirectStrategy().sendRedirect(request, response, _ajaxAuthenticationFailureUrl);
        }
        else {
            super.onAuthenticationFailure(request, response, exception);
        }

    }
ej83mcc0

ej83mcc01#

你可以在你的项目中为root设置日志级别为debug,这样它就可以记录所有的事情,或者你可以只为springsecurity设置它。试试这个链接:How do I enable logging for Spring Security?

相关问题