Return-Path: X-Original-To: apmail-logging-commits-archive@minotaur.apache.org Delivered-To: apmail-logging-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9554F11875 for ; Mon, 11 Aug 2014 03:09:15 +0000 (UTC) Received: (qmail 16397 invoked by uid 500); 11 Aug 2014 03:09:15 -0000 Delivered-To: apmail-logging-commits-archive@logging.apache.org Received: (qmail 16367 invoked by uid 500); 11 Aug 2014 03:09:15 -0000 Mailing-List: contact commits-help@logging.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@logging.apache.org Delivered-To: mailing list commits@logging.apache.org Received: (qmail 16358 invoked by uid 99); 11 Aug 2014 03:09:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Aug 2014 03:09:15 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Aug 2014 03:09:14 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id DAB302388906; Mon, 11 Aug 2014 03:08:53 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@logging.apache.org From: mattsicker@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140811030853.DAB302388906@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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; }