You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by gg...@apache.org on 2017/07/14 21:31:07 UTC

logging-log4j2 git commit: Clean up internal status logging.

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 512c03c0e -> 8133b6a02


Clean up internal status logging.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/8133b6a0
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/8133b6a0
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/8133b6a0

Branch: refs/heads/master
Commit: 8133b6a021a62a3cd0392813b5235fd7b2373333
Parents: 512c03c
Author: Gary Gregory <gg...@apache.org>
Authored: Fri Jul 14 14:31:05 2017 -0700
Committer: Gary Gregory <gg...@apache.org>
Committed: Fri Jul 14 14:31:05 2017 -0700

----------------------------------------------------------------------
 .../core/config/plugins/util/ResolverUtil.java  | 22 ++++++++------------
 1 file changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/8133b6a0/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtil.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtil.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtil.java
index 6d9178c..3ef796a 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtil.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/config/plugins/util/ResolverUtil.java
@@ -177,7 +177,7 @@ public class ResolverUtil {
         try {
             urls = loader.getResources(packageName);
         } catch (final IOException ioe) {
-            LOGGER.warn("Could not read package: " + packageName, ioe);
+            LOGGER.warn("Could not read package: {}", packageName, ioe);
             return;
         }
 
@@ -186,7 +186,7 @@ public class ResolverUtil {
                 final URL url = urls.nextElement();
                 final String urlPath = extractPath(url);
 
-                LOGGER.info("Scanning for classes in [" + urlPath + "] matching criteria: " + test);
+                LOGGER.info("Scanning for classes in '{}' matching criteria {}", urlPath , test);
                 // Check for a jar in a war in JBoss
                 if (VFSZIP.equals(url.getProtocol())) {
                     final String path = urlPath.substring(0, urlPath.length() - packageName.length() - 2);
@@ -316,17 +316,13 @@ public class ResolverUtil {
      *        the jar file to be examined for classes
      */
     private void loadImplementationsInJar(final Test test, final String parent, final File jarFile) {
-        @SuppressWarnings("resource")
         JarInputStream jarStream = null;
         try {
             jarStream = new JarInputStream(new FileInputStream(jarFile));
             loadImplementationsInJar(test, parent, jarFile.getPath(), jarStream);
-        } catch (final FileNotFoundException ex) {
-            LOGGER.error("Could not search jar file '" + jarFile + "' for classes matching criteria: " + test
-                    + " file not found", ex);
-        } catch (final IOException ioe) {
-            LOGGER.error("Could not search jar file '" + jarFile + "' for classes matching criteria: " + test
-                    + " due to an IOException", ioe);
+        } catch (final IOException ex) {
+            LOGGER.error("Could not search JAR file '{}' for classes matching criteria {}, file not found", jarFile,
+                    test, ex);
         } finally {
             close(jarStream, jarFile);
         }
@@ -370,8 +366,8 @@ public class ResolverUtil {
                 }
             }
         } catch (final IOException ioe) {
-            LOGGER.error("Could not search jar file '" + path + "' for classes matching criteria: " + test
-                    + " due to an IOException", ioe);
+            LOGGER.error("Could not search JAR file '{}' for classes matching criteria {} due to an IOException", path,
+                    test, ioe);
         }
     }
 
@@ -390,7 +386,7 @@ public class ResolverUtil {
             if (test.doesMatchClass()) {
                 final String externalName = fqn.substring(0, fqn.indexOf('.')).replace('/', '.');
                 if (LOGGER.isDebugEnabled()) {
-                    LOGGER.debug("Checking to see if class " + externalName + " matches criteria [" + test + ']');
+                    LOGGER.debug("Checking to see if class {} matches criteria {}", externalName, test);
                 }
 
                 final Class<?> type = loader.loadClass(externalName);
@@ -408,7 +404,7 @@ public class ResolverUtil {
                 }
             }
         } catch (final Throwable t) {
-            LOGGER.warn("Could not examine class '" + fqn, t);
+            LOGGER.warn("Could not examine class {}", fqn, t);
         }
     }