Skip to content

Commit 22bfd5a

Browse files
committed
Merge branch '5.3.x'
2 parents 0f4205a + 8b34558 commit 22bfd5a

File tree

2 files changed

+34
-15
lines changed

2 files changed

+34
-15
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ configure(allprojects) { project ->
168168
}
169169
dependency "org.testng:testng:7.4.0"
170170
dependency "org.junit.support:testng-engine:1.0.1"
171-
dependency "org.hamcrest:hamcrest:2.1"
171+
dependency "org.hamcrest:hamcrest:2.2"
172172
dependency "org.awaitility:awaitility:3.1.6"
173173
dependency "org.assertj:assertj-core:3.23.1"
174174
dependencySet(group: 'org.xmlunit', version: '2.9.0') {

spring-context/src/main/java/org/springframework/cache/interceptor/LoggingCacheErrorHandler.java

Lines changed: 33 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,55 @@
2424
import org.springframework.util.Assert;
2525

2626
/**
27-
* A {@link CacheErrorHandler} implementation that logs error message. Can be
28-
* used when underlying cache errors should be ignored.
27+
* A {@link CacheErrorHandler} implementation that logs error messages.
28+
*
29+
* <p>Can be used when underlying cache errors should be ignored.
2930
*
3031
* @author Adam Ostrožlík
3132
* @author Stephane Nicoll
33+
* @author Vedran Pavic
34+
* @author Sam Brannen
3235
* @since 5.3.16
3336
*/
3437
public class LoggingCacheErrorHandler implements CacheErrorHandler {
3538

3639
private final Log logger;
3740

38-
private final boolean logStacktrace;
41+
private final boolean logStackTraces;
3942

4043

4144
/**
42-
* Create an instance with the {@link Log logger} to use.
43-
* @param logger the logger to use
44-
* @param logStacktrace whether to log stack trace
45+
* Create a {@code LoggingCacheErrorHandler} that uses the default logging
46+
* category and does not log stack traces.
47+
* <p>The default logging category is
48+
* "{@code org.springframework.cache.interceptor.LoggingCacheErrorHandler}".
4549
*/
46-
public LoggingCacheErrorHandler(Log logger, boolean logStacktrace) {
47-
Assert.notNull(logger, "Logger must not be null");
48-
this.logger = logger;
49-
this.logStacktrace = logStacktrace;
50+
public LoggingCacheErrorHandler() {
51+
this(false);
5052
}
5153

5254
/**
53-
* Create an instance that does not log stack traces.
55+
* Create a {@code LoggingCacheErrorHandler} that uses the default logging
56+
* category and the supplied {@code logStackTraces} flag.
57+
* <p>The default logging category is
58+
* "{@code org.springframework.cache.interceptor.LoggingCacheErrorHandler}".
59+
* @param logStackTraces whether to log stack traces
60+
* @since 5.3.22
5461
*/
55-
public LoggingCacheErrorHandler() {
56-
this(LogFactory.getLog(LoggingCacheErrorHandler.class), false);
62+
public LoggingCacheErrorHandler(boolean logStackTraces) {
63+
this(LogFactory.getLog(LoggingCacheErrorHandler.class), logStackTraces);
64+
}
65+
66+
/**
67+
* Create a {@code LoggingCacheErrorHandler} that uses the supplied
68+
* {@link Log logger} and {@code logStackTraces} flag.
69+
* @param logger the logger to use
70+
* @param logStackTraces whether to log stack traces
71+
*/
72+
public LoggingCacheErrorHandler(Log logger, boolean logStackTraces) {
73+
Assert.notNull(logger, "'logger' must not be null");
74+
this.logger = logger;
75+
this.logStackTraces = logStackTraces;
5776
}
5877

5978

@@ -90,7 +109,7 @@ public void handleCacheClearError(RuntimeException exception, Cache cache) {
90109
* @param ex the exception
91110
*/
92111
protected void logCacheError(Log logger, String message, RuntimeException ex) {
93-
if (this.logStacktrace) {
112+
if (this.logStackTraces) {
94113
logger.warn(message, ex);
95114
}
96115
else {

0 commit comments

Comments
 (0)