Skip to content

Commit ac9bdf5

Browse files
baezzysjzheaux
authored andcommitted
Change DefaultSecurityFilterChain logging to DEBUG level and simplify filter log
- Change DefaultSecurityFilterChain logging level from INFO to DEBUG to align with FilterChainProxy. - Log filter class names instead of the toString() of filter.
1 parent da1869c commit ac9bdf5

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

web/src/main/java/org/springframework/security/web/DefaultSecurityFilterChain.java

+15-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -32,6 +32,7 @@
3232
* Standard implementation of {@code SecurityFilterChain}.
3333
*
3434
* @author Luke Taylor
35+
* @author Jinwoo Bae
3536
* @since 3.1
3637
*/
3738
public final class DefaultSecurityFilterChain implements SecurityFilterChain {
@@ -48,10 +49,21 @@ public DefaultSecurityFilterChain(RequestMatcher requestMatcher, Filter... filte
4849

4950
public DefaultSecurityFilterChain(RequestMatcher requestMatcher, List<Filter> filters) {
5051
if (filters.isEmpty()) {
51-
logger.info(LogMessage.format("Will not secure %s", requestMatcher));
52+
logger.debug(LogMessage.format("Will not secure %s", requestMatcher));
5253
}
5354
else {
54-
logger.info(LogMessage.format("Will secure %s with %s", requestMatcher, filters));
55+
StringBuilder filterClassNames = new StringBuilder();
56+
String separator = ", ";
57+
58+
for (Filter f : filters) {
59+
if (!filterClassNames.isEmpty()) {
60+
filterClassNames.append(separator);
61+
}
62+
filterClassNames.append(f.getClass().getSimpleName());
63+
}
64+
65+
logger.debug(
66+
LogMessage.format("Will secure %s with filters: %s", requestMatcher, filterClassNames.toString()));
5567
}
5668
this.requestMatcher = requestMatcher;
5769
this.filters = new ArrayList<>(filters);

0 commit comments

Comments
 (0)