You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by oh...@apache.org on 2006/12/22 19:19:00 UTC
svn commit: r489708 - in
/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration:
AbstractFileConfiguration.java ConfigurationUtils.java
plist/XMLPropertyListConfiguration.java
Author: oheger
Date: Fri Dec 22 10:18:57 2006
New Revision: 489708
URL: http://svn.apache.org/viewvc?view=rev&rev=489708
Log:
Removed some output to System.err, improved some log messages; related to CONFIGURATION-232
Modified:
jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java
jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationUtils.java
jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/plist/XMLPropertyListConfiguration.java
Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java?view=diff&rev=489708&r1=489707&r2=489708
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java (original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/AbstractFileConfiguration.java Fri Dec 22 10:18:57 2006
@@ -34,6 +34,8 @@
import org.apache.commons.configuration.reloading.InvariantReloadingStrategy;
import org.apache.commons.configuration.reloading.ReloadingStrategy;
import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* <p>Partial implementation of the <code>FileConfiguration</code> interface.
@@ -93,6 +95,9 @@
/** Holds a reference to the reloading strategy.*/
protected ReloadingStrategy strategy;
+ /** The logger.*/
+ private Log log = LogFactory.getLog(getClass());
+
/** A lock object for protecting reload operations.*/
private Object reloadLock = new Object();
@@ -299,7 +304,7 @@
}
catch (IOException e)
{
- e.printStackTrace();
+ log.warn("Could not close input stream", e);
}
}
}
@@ -463,7 +468,7 @@
}
catch (IOException e)
{
- e.printStackTrace();
+ log.warn("Could not close output stream", e);
}
}
}
@@ -770,6 +775,10 @@
if (strategy.reloadingRequired())
{
+ if (log.isInfoEnabled())
+ {
+ log.info("Reloading configuration. URL is " + getURL());
+ }
fireEvent(EVENT_RELOAD, null, getURL(), true);
setDetailEvents(false);
try
@@ -789,7 +798,7 @@
}
catch (Exception e)
{
- e.printStackTrace();
+ log.warn("Error when reloading configuration", e);
// todo rollback the changes if the file can't be reloaded
}
finally
Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationUtils.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationUtils.java?view=diff&rev=489708&r1=489707&r2=489708
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationUtils.java (original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/ConfigurationUtils.java Fri Dec 22 10:18:57 2006
@@ -382,6 +382,14 @@
*/
public static URL locate(String base, String name)
{
+ if (log.isDebugEnabled())
+ {
+ StringBuffer buf = new StringBuffer();
+ buf.append("ConfigurationUtils.locate(): base is ").append(base);
+ buf.append(", name is ").append(name);
+ log.debug(buf.toString());
+ }
+
if (name == null)
{
// undefined, always return null
@@ -417,7 +425,7 @@
}
}
- log.debug("Configuration loaded from the URL " + url);
+ log.debug("Loading configuration from the URL " + url);
}
catch (IOException e)
{
@@ -433,11 +441,11 @@
try
{
url = file.toURL();
- log.debug("Configuration loaded from the absolute path " + name);
+ log.debug("Loading configuration from the absolute path " + name);
}
catch (MalformedURLException e)
{
- e.printStackTrace();
+ log.warn("Could not obtain URL from file", e);
}
}
}
@@ -455,12 +463,12 @@
if (url != null)
{
- log.debug("Configuration loaded from the base path " + name);
+ log.debug("Loading configuration from the path " + file);
}
}
- catch (IOException e)
+ catch (MalformedURLException e)
{
- e.printStackTrace();
+ log.warn("Could not obtain URL from file", e);
}
}
@@ -477,13 +485,13 @@
if (url != null)
{
- log.debug("Configuration loaded from the home path " + name);
+ log.debug("Loading configuration from the home path " + file);
}
}
- catch (IOException e)
+ catch (MalformedURLException e)
{
- e.printStackTrace();
+ log.warn("Could not obtain URL from file", e);
}
}
@@ -512,7 +520,7 @@
if (url != null)
{
- log.debug("Configuration loaded from the context classpath (" + resourceName + ")");
+ log.debug("Loading configuration from the context classpath (" + resourceName + ")");
}
}
@@ -523,7 +531,7 @@
if (url != null)
{
- log.debug("Configuration loaded from the system classpath (" + resourceName + ")");
+ log.debug("Loading configuration from the system classpath (" + resourceName + ")");
}
}
return url;
Modified: jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/plist/XMLPropertyListConfiguration.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/plist/XMLPropertyListConfiguration.java?view=diff&rev=489708&r1=489707&r2=489708
==============================================================================
--- jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/plist/XMLPropertyListConfiguration.java (original)
+++ jakarta/commons/proper/configuration/trunk/src/java/org/apache/commons/configuration/plist/XMLPropertyListConfiguration.java Fri Dec 22 10:18:57 2006
@@ -495,7 +495,8 @@
}
catch (ParseException e)
{
- e.printStackTrace();
+ // ignore
+ ;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org