{"record":{"id":"92cc0d55f2454944","repo":"spring-projects/spring-security","slug":"authentication-event-s-s-details-s-exceptio","errorCode":null,"errorMessage":"Authentication event %s: %s; details: %s; exception: %s","messagePattern":"Authentication event (.+?): (.+?); details: (.+?); exception: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"core/src/main/java/org/springframework/security/authentication/event/LoggerListener.java","lineNumber":48,"sourceCode":" *\n * @author Ben Alex\n */\npublic class LoggerListener implements ApplicationListener<AbstractAuthenticationEvent> {\n\n\tprivate static final Log logger = LogFactory.getLog(LoggerListener.class);\n\n\t/**\n\t * If set to true, {@link InteractiveAuthenticationSuccessEvent} will be logged\n\t * (defaults to true).\n\t */\n\tprivate boolean logInteractiveAuthenticationSuccessEvents = true;\n\n\t@Override\n\tpublic void onApplicationEvent(AbstractAuthenticationEvent event) {\n\t\tif (!this.logInteractiveAuthenticationSuccessEvents && event instanceof InteractiveAuthenticationSuccessEvent) {\n\t\t\treturn;\n\t\t}\n\t\tlogger.warn(LogMessage.of(() -> getLogMessage(event)));\n\t}\n\n\tprivate String getLogMessage(AbstractAuthenticationEvent event) {\n\t\tStringBuilder builder = new StringBuilder();\n\t\tbuilder.append(\"Authentication event \");\n\t\tbuilder.append(ClassUtils.getShortName(event.getClass()));\n\t\tbuilder.append(\": \");\n\t\tbuilder.append(event.getAuthentication().getName());\n\t\tbuilder.append(\"; details: \");\n\t\tbuilder.append(event.getAuthentication().getDetails());\n\t\tif (event instanceof AbstractAuthenticationFailureEvent) {\n\t\t\tbuilder.append(\"; exception: \");\n\t\t\tbuilder.append(((AbstractAuthenticationFailureEvent) event).getException().getMessage());\n\t\t}\n\t\treturn builder.toString();\n\t}\n\n\tpublic boolean isLogInteractiveAuthenticationSuccessEvents() {","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/spring-projects/spring-security/blob/96852e8860138a482cb13d1479573f24ff6443c6/core/src/main/java/org/springframework/security/authentication/event/LoggerListener.java#L30-L66","documentation":"LoggerListener is an application listener that logs every AbstractAuthenticationEvent (success or failure) at warn level, including event class, result, authentication details, and any exception. It is a diagnostic aid for auditing authentication flows, not an error condition itself.","triggerScenarios":"LoggerListener is registered as a bean and any authentication event is published: AbstractAuthenticationFailureEvent, AuthenticationSuccessEvent, or (if enabled) InteractiveAuthenticationSuccessEvent via onApplicationEvent.","commonSituations":"Troubleshooting failed logins; auditing authentication in logs; seeing this line when investigating why a login failed (the embedded exception names the cause like BadCredentialsException).","solutions":["Inspect the 'exception' field in the logged message to identify the actual authentication failure cause","Remove the LoggerListener bean or lower log verbosity if these warnings are unwanted in production","Configure logInteractiveAuthenticationSuccessEvents=false to suppress interactive success event noise"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Register LoggerListener only in environments where authentication audit logging is wanted","Route org.springframework.security logs to an audit appender instead of default warn noise","Parse the 'exception' field of the message to triage login failures (bad credentials, locked, expired)"],"tags":["spring-security","authentication-events","auditing","logging"],"backgroundTag":"authentication-required","analyzedSha":"96852e8860138a482cb13d1479573f24ff6443c6","analyzedAt":"2026-09-10T23:25:23.477Z","contentChangedAt":"2026-09-10T23:25:23.477Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}