diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-01 11:56:55 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2011-02-01 11:56:55 +0000 |
commit | cdc50306297ca9c420280f9cabf4a0b95836ce01 (patch) | |
tree | cd17c986d69fdcc8c7b464f128efeb9a2687476f /sca-java-2.x/trunk/modules/core/src/main | |
parent | cd68df4df647f3bf14b2aa1b4ee33372bdcc0992 (diff) |
Start quiet logging updates by changing endpoint registry logging. Seems a little long winded so maybe need to find somethinf simpler
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1066015 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/core/src/main')
-rw-r--r-- | sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java index aa1a4001a4..7555b95140 100644 --- a/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java +++ b/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/impl/EndpointRegistryImpl.java @@ -22,14 +22,19 @@ package org.apache.tuscany.sca.core.assembly.impl; import java.util.ArrayList; import java.util.Iterator; import java.util.List; +import java.util.Properties; +import java.util.logging.Level; import java.util.logging.Logger; +import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.Endpoint; import org.apache.tuscany.sca.core.ExtensionPointRegistry; import org.apache.tuscany.sca.core.LifeCycleListener; +import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.runtime.BaseEndpointRegistry; import org.apache.tuscany.sca.runtime.EndpointListener; import org.apache.tuscany.sca.runtime.EndpointRegistry; +import org.apache.tuscany.sca.runtime.RuntimeProperties; /** * A EndpointRegistry implementation that sees registrations from the same JVM @@ -38,9 +43,13 @@ public class EndpointRegistryImpl extends BaseEndpointRegistry implements Endpoi private final Logger logger = Logger.getLogger(EndpointRegistryImpl.class.getName()); private List<Endpoint> endpoints = new ArrayList<Endpoint>(); + + protected boolean quietLogging; public EndpointRegistryImpl(ExtensionPointRegistry extensionPoints, String endpointRegistryURI, String domainURI) { super(extensionPoints, null, endpointRegistryURI, domainURI); + Properties runtimeProps = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class).getUtility(RuntimeProperties.class).getProperties(); + quietLogging = Boolean.parseBoolean(runtimeProps.getProperty(RuntimeProperties.QUIET_LOGGING)); } public synchronized void addEndpoint(Endpoint endpoint) { @@ -48,7 +57,22 @@ public class EndpointRegistryImpl extends BaseEndpointRegistry implements Endpoi for (EndpointListener listener : listeners) { listener.endpointAdded(endpoint); } - logger.info("Add endpoint - " + endpoint.toString()); + if (logger.isLoggable(quietLogging ? Level.FINE : Level.INFO)) { + String uri = null; + Binding b = endpoint.getBinding(); + if (b != null) { + uri = b.getURI(); + if (uri != null && uri.startsWith("/")) { + uri = uri.substring(1); + } + } + String msg = "Add endpoint - " + (uri == null ? endpoint.getURI() : b.getType().getLocalPart()+" - " + uri); + if (quietLogging) { + logger.fine(msg); + } else { + logger.info(msg); + } + } } public List<Endpoint> findEndpoint(String uri) { @@ -66,7 +90,22 @@ public class EndpointRegistryImpl extends BaseEndpointRegistry implements Endpoi public synchronized void removeEndpoint(Endpoint endpoint) { endpoints.remove(endpoint); endpointRemoved(endpoint); - logger.info("Remove endpoint - " + endpoint.toString()); + if (logger.isLoggable(quietLogging ? Level.FINE : Level.INFO)) { + String uri = null; + Binding b = endpoint.getBinding(); + if (b != null) { + uri = b.getURI(); + if (uri != null && uri.startsWith("/")) { + uri = uri.substring(1); + } + } + String msg = "Remove endpoint - " + (uri == null ? endpoint.getURI() : b.getType().getLocalPart()+" - "+uri); + if (quietLogging) { + logger.fine(msg); + } else { + logger.info(msg); + } + } } public synchronized List<Endpoint> getEndpoints() { |