diff --git a/pom.xml b/pom.xml index 846b9223..34ffcc10 100644 --- a/pom.xml +++ b/pom.xml @@ -31,14 +31,14 @@ - - spring-libs-snapshot - https://repo.spring.io/libs-snapshot - apache-snapshots https://repository.apache.org/content/repositories/snapshots + + spring-libs-snapshot + https://repo.spring.io/libs-snapshot + diff --git a/src/main/java/org/springframework/data/gemfire/CacheFactoryBean.java b/src/main/java/org/springframework/data/gemfire/CacheFactoryBean.java index ea80ea05..c0403123 100644 --- a/src/main/java/org/springframework/data/gemfire/CacheFactoryBean.java +++ b/src/main/java/org/springframework/data/gemfire/CacheFactoryBean.java @@ -16,6 +16,8 @@ package org.springframework.data.gemfire; +import static org.springframework.data.gemfire.GemfireUtils.apacheGeodeProductName; +import static org.springframework.data.gemfire.GemfireUtils.apacheGeodeVersion; import static org.springframework.data.gemfire.support.GemfireBeanFactoryLocator.newBeanFactoryLocator; import java.io.File; @@ -187,7 +189,6 @@ public class CacheFactoryBean implements BeanClassLoaderAware, BeanFactoryAware, } /* (non-Javadoc) */ - @SuppressWarnings("deprecation") Cache init() throws Exception { ClassLoader currentThreadContextClassLoader = Thread.currentThread().getContextClassLoader(); @@ -201,13 +202,15 @@ public class CacheFactoryBean implements BeanClassLoaderAware, BeanFactoryAware, DistributedMember member = system.getDistributedMember(); - log.info(String.format("Connected to Distributed System [%1$s] as Member [%2$s]" - .concat("in Group(s) [%3$s] with Role(s) [%4$s] on Host [%5$s] having PID [%6$d]."), - system.getName(), member.getId(), member.getGroups(), member.getRoles(), member.getHost(), - member.getProcessId())); + if (log.isInfoEnabled()) { + log.info(String.format("Connected to Distributed System [%1$s] as Member [%2$s]" + .concat(" in Group(s) [%3$s] with Role(s) [%4$s] on Host [%5$s] having PID [%6$d]."), + system.getName(), member.getId(), member.getGroups(), member.getRoles(), member.getHost(), + member.getProcessId())); - log.info(String.format("%1$s GemFire v.%2$s Cache [%3$s].", cacheResolutionMessagePrefix, - CacheFactory.getVersion(), cache.getName())); + log.info(String.format("%1$s %2$s version [%3$s] Cache [%4$s].", + cacheResolutionMessagePrefix, apacheGeodeProductName(), apacheGeodeVersion(), cache.getName())); + } return cache; } diff --git a/src/main/java/org/springframework/data/gemfire/GemfireUtils.java b/src/main/java/org/springframework/data/gemfire/GemfireUtils.java index b237098c..6874441e 100644 --- a/src/main/java/org/springframework/data/gemfire/GemfireUtils.java +++ b/src/main/java/org/springframework/data/gemfire/GemfireUtils.java @@ -33,10 +33,13 @@ import org.w3c.dom.Element; * @see org.apache.geode.cache.Region * @since 1.3.3 */ +@SuppressWarnings("unused") public abstract class GemfireUtils extends CacheUtils { - public final static String GEMFIRE_NAME = GemFireVersion.getProductName(); - public final static String GEMFIRE_VERSION = CacheFactory.getVersion(); + public final static String APACHE_GEODE_NAME = "Aache Geode"; + public final static String GEMFIRE_NAME = apacheGeodeProductName(); + public final static String GEMFIRE_VERSION = apacheGeodeVersion(); + public final static String UNKNOWN = "unknown"; private static final String ASYNC_EVENT_QUEUE_ELEMENT_NAME = "async-event-queue"; private static final String ASYNC_EVENT_QUEUE_TYPE_NAME = "org.apache.geode.cache.asyncqueue.AsyncEventQueue"; @@ -47,6 +50,26 @@ public abstract class GemfireUtils extends CacheUtils { private static final String GATEWAY_SENDER_ELEMENT_NAME = "gateway-sender"; private static final String GATEWAY_SENDER_TYPE_NAME = "org.apache.geode.internal.cache.wan.GatewaySenderFactoryImpl"; + /* (non-Javadoc) */ + public static String apacheGeodeProductName() { + try { + return GemFireVersion.getProductName(); + } + catch (Throwable ignore) { + return APACHE_GEODE_NAME; + } + } + + /* (non-Javadoc) */ + public static String apacheGeodeVersion() { + try { + return CacheFactory.getVersion(); + } + catch (Throwable ignore) { + return UNKNOWN; + } + } + /* (non-Javadoc) */ public static boolean isClassAvailable(String fullyQualifiedClassName) { return ClassUtils.isPresent(fullyQualifiedClassName, GemfireUtils.class.getClassLoader()); @@ -115,5 +138,4 @@ public abstract class GemfireUtils extends CacheUtils { //System.out.printf("Is GemFire Version 6.5 of Above? %1$s%n", isGemfireVersion65OrAbove()); //System.out.printf("Is GemFire Version 7.0 of Above? %1$s%n", isGemfireVersion7OrAbove()); } - } diff --git a/src/test/resources/log4j.properties b/src/test/resources/log4j.properties index 461e444c..4a6328f9 100644 --- a/src/test/resources/log4j.properties +++ b/src/test/resources/log4j.properties @@ -1,4 +1,4 @@ -log4j.rootCategory=WARN, stdout +log4j.rootCategory=ERROR, stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout diff --git a/src/test/resources/logback.xml b/src/test/resources/logback.xml index 5af5ca74..2db6ee44 100644 --- a/src/test/resources/logback.xml +++ b/src/test/resources/logback.xml @@ -6,9 +6,9 @@ - + - +