[FELIX-3609] Optimization: avoid unnecessary toString() computations

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1365507 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java b/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
index 376ffcb..cc9a387 100644
--- a/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
+++ b/framework/src/main/java/org/apache/felix/framework/StatefulResolver.java
@@ -761,6 +761,8 @@
     private void markResolvedRevisions(Map<BundleRevision, List<ResolverWire>> wireMap)
         throws ResolveException
     {
+        boolean debugLog = m_felix.getLogger().getLogLevel() >= Logger.LOG_DEBUG;
+
         // DO THIS IN THREE PASSES:
         // 1. Aggregate fragments per host.
         // 2. Attach wires and fragments to hosts.
@@ -841,13 +843,19 @@
 
                     if (Util.isFragment(revision))
                     {
-                        m_felix.getLogger().log(
-                            Logger.LOG_DEBUG,
-                            "FRAGMENT WIRE: " + rw.toString());
+                        if (debugLog)
+                        {
+                            m_felix.getLogger().log(
+                                Logger.LOG_DEBUG,
+                                "FRAGMENT WIRE: " + rw.toString());
+                        }
                     }
                     else
                     {
-                        m_felix.getLogger().log(Logger.LOG_DEBUG, "WIRE: " + rw.toString());
+                        if (debugLog)
+                        {
+                            m_felix.getLogger().log(Logger.LOG_DEBUG, "WIRE: " + rw.toString());
+                        }
 
                         if (rw.getCapability().getNamespace()
                             .equals(BundleRevision.PACKAGE_NAMESPACE))