diff --git a/web/src/main/java/org/springframework/security/web/session/SimpleRedirectInvalidSessionStrategy.java b/web/src/main/java/org/springframework/security/web/session/SimpleRedirectInvalidSessionStrategy.java index 6fd0f7b3cb..35db022e9e 100644 --- a/web/src/main/java/org/springframework/security/web/session/SimpleRedirectInvalidSessionStrategy.java +++ b/web/src/main/java/org/springframework/security/web/session/SimpleRedirectInvalidSessionStrategy.java @@ -52,7 +52,9 @@ public final class SimpleRedirectInvalidSessionStrategy implements InvalidSessio @Override public void onInvalidSessionDetected(HttpServletRequest request, HttpServletResponse response) throws IOException { - this.logger.debug("Starting new session (if required) and redirecting to '" + this.destinationUrl + "'"); + if (this.logger.isDebugEnabled()) { + this.logger.debug("Starting new session (if required) and redirecting to '" + this.destinationUrl + "'"); + } if (this.createNewSession) { request.getSession(); }