Skip to content

Commit a85ce9c

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 Issue gh-9648
1 parent 6c5e92f commit a85ce9c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ public SimpleRedirectInvalidSessionStrategy(String invalidSessionUrl) {
4646

4747
public void onInvalidSessionDetected(HttpServletRequest request,
4848
HttpServletResponse response) throws IOException {
49-
logger.debug("Starting new session (if required) and redirecting to '"
50-
+ destinationUrl + "'");
49+
if (logger.isDebugEnabled()) {
50+
logger.debug("Starting new session (if required) and redirecting to '"
51+
+ destinationUrl + "'");
52+
}
5153
if (createNewSession) {
5254
request.getSession();
5355
}

0 commit comments

Comments
 (0)