logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattsic...@apache.org
Subject svn commit: r1617198 - /logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java
Date Mon, 11 Aug 2014 03:08:53 GMT
Author: mattsicker
Date: Mon Aug 11 03:08:53 2014
New Revision: 1617198

URL: http://svn.apache.org/r1617198
Log:
Use parametrized logging.

Modified:
    logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java

Modified: logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java?rev=1617198&r1=1617197&r2=1617198&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java
(original)
+++ logging/log4j/log4j2/trunk/log4j-core/src/main/java/org/apache/logging/log4j/core/config/xml/XmlConfiguration.java
Mon Aug 11 03:08:53 2014
@@ -45,6 +45,7 @@ import org.apache.logging.log4j.core.con
 import org.apache.logging.log4j.core.config.plugins.util.PluginType;
 import org.apache.logging.log4j.core.config.plugins.util.ResolverUtil;
 import org.apache.logging.log4j.core.config.status.StatusConfiguration;
+import org.apache.logging.log4j.core.util.Closer;
 import org.apache.logging.log4j.core.util.Loader;
 import org.apache.logging.log4j.core.util.Patterns;
 import org.w3c.dom.Attr;
@@ -129,7 +130,7 @@ public class XmlConfiguration extends Ab
             try {
                 buffer = toByteArray(configStream);
             } finally {
-                configStream.close();
+                Closer.closeSilently(configStream);
             }
             final InputSource source = new InputSource(new ByteArrayInputStream(buffer));
             source.setSystemId(configSource.getLocation());
@@ -168,11 +169,11 @@ public class XmlConfiguration extends Ab
             }
             statusConfig.initialize();
         } catch (final SAXException domEx) {
-            LOGGER.error("Error parsing " + configSource.getLocation(), domEx);
+            LOGGER.error("Error parsing {}", configSource.getLocation(), domEx);
         } catch (final IOException ioe) {
-            LOGGER.error("Error parsing " + configSource.getLocation(), ioe);
+            LOGGER.error("Error parsing {}", configSource.getLocation(), ioe);
         } catch (final ParserConfigurationException pex) {
-            LOGGER.error("Error parsing " + configSource.getLocation(), pex);
+            LOGGER.error("Error parsing {}", configSource.getLocation(), pex);
         }
         if (strict && schema != null && buffer != null) {
             InputStream is = null;
@@ -217,7 +218,7 @@ public class XmlConfiguration extends Ab
         constructHierarchy(rootNode, rootElement);
         if (status.size() > 0) {
             for (final Status s : status) {
-                LOGGER.error("Error processing element " + s.name + ": " + s.errorType);
+                LOGGER.error("Error processing element {}: {}", s.name, s.errorType);
             }
             return;
         }
@@ -234,7 +235,7 @@ public class XmlConfiguration extends Ab
             final XmlConfiguration config = new XmlConfiguration(source);
             return (config.rootElement == null) ? null : config;
         } catch (final IOException ex) {
-            LOGGER.error("Cannot locate file " + getConfigurationSource(), ex);
+            LOGGER.error("Cannot locate file {}", getConfigurationSource(), ex);
         }
         return null;
     }



Mime
View raw message