Skip to content

Commit dc6e512

Browse files
committed
EhCacheManagerFactoryBean logs cache manager name
Issue: SPR-14110 (cherry picked from commit 8bfba6a)
1 parent 0ed7f9a commit dc6e512

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

spring-context-support/src/main/java/org/springframework/cache/ehcache/EhCacheManagerFactoryBean.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2016 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.
@@ -81,7 +81,7 @@ public void setConfigLocation(Resource configLocation) {
8181

8282
/**
8383
* Set the name of the EhCache CacheManager (if a specific name is desired).
84-
* @see net.sf.ehcache.CacheManager#setName(String)
84+
* @see net.sf.ehcache.config.Configuration#setName(String)
8585
*/
8686
public void setCacheManagerName(String cacheManagerName) {
8787
this.cacheManagerName = cacheManagerName;
@@ -126,12 +126,17 @@ public void setShared(boolean shared) {
126126

127127
@Override
128128
public void afterPropertiesSet() throws CacheException {
129-
logger.info("Initializing EhCache CacheManager");
129+
if (logger.isInfoEnabled()) {
130+
logger.info("Initializing EhCache CacheManager" +
131+
(this.cacheManagerName != null ? " '" + this.cacheManagerName + "'" : ""));
132+
}
133+
130134
Configuration configuration = (this.configLocation != null ?
131135
EhCacheManagerUtils.parseConfiguration(this.configLocation) : ConfigurationFactory.parseConfiguration());
132136
if (this.cacheManagerName != null) {
133137
configuration.setName(this.cacheManagerName);
134138
}
139+
135140
if (this.shared) {
136141
// Old-school EhCache singleton sharing...
137142
// No way to find out whether we actually created a new CacheManager
@@ -178,7 +183,10 @@ public boolean isSingleton() {
178183
@Override
179184
public void destroy() {
180185
if (this.locallyManaged) {
181-
logger.info("Shutting down EhCache CacheManager");
186+
if (logger.isInfoEnabled()) {
187+
logger.info("Shutting down EhCache CacheManager" +
188+
(this.cacheManagerName != null ? " '" + this.cacheManagerName + "'" : ""));
189+
}
182190
this.cacheManager.shutdown();
183191
}
184192
}

0 commit comments

Comments
 (0)