diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-30 19:32:33 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-03-30 19:32:33 +0000 |
commit | c1fc4bd1ac2a2133b870e4314424cfd050bef607 (patch) | |
tree | c9dca5b97c41ed309918711148a5244f8de1dddc | |
parent | f3518e8a524f3c528094ca29b4df935a357abb71 (diff) |
Set the logging level for hazelcast classes to WARNING when the Tuscany level is the default (INFO) level. Thats because hazelcast creates lots of info log messages especially when using the client which we don't really need or want to see. When necessary those hazelcast messages can still be got by setting the tuscany or individual hazxelcast classes to log level to FINE
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1087053 13f79535-47bb-0310-9956-ffa450edef68
2 files changed, 30 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java b/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java index aa97ff3a1b..45ebf344d8 100644 --- a/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/HazelcastEndpointRegistry.java @@ -27,6 +27,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.concurrent.ConcurrentHashMap; +import java.util.logging.Level; import java.util.logging.Logger; import org.apache.tuscany.sca.assembly.AssemblyFactory; @@ -121,6 +122,20 @@ public class HazelcastEndpointRegistry extends BaseEndpointRegistry implements E } private void initHazelcastInstance() { + + // Hazelcast is outputs a lot on info level log messages which are unnecessary for us, + // so disable info logging for hazelcast client classes unless fine logging is on for tuscany. + if (!logger.isLoggable(Level.CONFIG)) { + Logger hzl = Logger.getLogger("com.hazelcast"); + if (!hzl.isLoggable(Level.FINE)) { + hzl.setLevel(Level.WARNING); + // we want the ClusterManager info messages so we can see nodes come and go + Logger.getLogger("com.hazelcast.cluster.ClusterManager").setLevel(Level.INFO); + // we don't want any of the XmlConfigBuilder warnings as set the config programatically + Logger.getLogger("com.hazelcast.config.XmlConfigBuilder").setLevel(Level.SEVERE); + } + } + Config config = getHazelcastConfig(); // do this when theres a way to have adders be the key owners @@ -141,6 +156,9 @@ public class HazelcastEndpointRegistry extends BaseEndpointRegistry implements E "1"); this.hazelcastInstance = Hazelcast.newHazelcastInstance(config); + if (logger.isLoggable(Level.INFO)) { + logger.info("started node in domain '" + domainURI + "' + at: " + hazelcastInstance.getCluster().getLocalMember().getInetSocketAddress()); + } } protected Config getHazelcastConfig() { diff --git a/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/client/HazelcastClientEndpointRegistry.java b/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/client/HazelcastClientEndpointRegistry.java index 1bc663fdfc..fe73a0882e 100644 --- a/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/client/HazelcastClientEndpointRegistry.java +++ b/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/endpoint/hazelcast/client/HazelcastClientEndpointRegistry.java @@ -25,7 +25,8 @@ import java.net.NetworkInterface; import java.net.ServerSocket; import java.util.Enumeration; import java.util.Map; -import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.UtilityExtensionPoint; @@ -85,6 +86,16 @@ public class HazelcastClientEndpointRegistry extends HazelcastEndpointRegistry { if (rc.getWKAs().size() < 1) { throw new IllegalArgumentException("Must specify remote IP address(es) for domain"); } + + // Hazelcast is outputs a lot on info level log messages which are unnecessary for us, + // so disable info logging for hazelcast client classes unless fine logging is on for tuscany. + if (!Logger.getLogger(this.getClass().getName()).isLoggable(Level.CONFIG)) { + Logger hzl = Logger.getLogger("com.hazelcast"); + if (!hzl.isLoggable(Level.FINE)) { + hzl.setLevel(Level.WARNING); + } + } + this.hazelcastClient = HazelcastClient.newHazelcastClient(rc.getUserid(), rc.getPassword(), rc.getWKAs().toArray(new String[0])); } |