Skip to content

Commit 7dc4de0

Browse files
candrewsjzheaux
authored andcommitted
Add guard around logger.debug statement
The log message involves string concatenation, the cost of which should only be incurred if debug logging is enabled
1 parent a31a855 commit 7dc4de0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

web/src/main/java/org/springframework/security/web/session/SimpleRedirectInvalidSessionStrategy.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ public SimpleRedirectInvalidSessionStrategy(String invalidSessionUrl) {
5252

5353
@Override
5454
public void onInvalidSessionDetected(HttpServletRequest request, HttpServletResponse response) throws IOException {
55-
this.logger.debug("Starting new session (if required) and redirecting to '" + this.destinationUrl + "'");
55+
if (this.logger.isDebugEnabled()) {
56+
this.logger.debug("Starting new session (if required) and redirecting to '" + this.destinationUrl + "'");
57+
}
5658
if (this.createNewSession) {
5759
request.getSession();
5860
}

0 commit comments

Comments
 (0)