From f87688012a2e9c34e19209975dab6855d7534143 Mon Sep 17 00:00:00 2001 From: Robert Burrell Donkin Date: Mon, 7 Feb 2005 20:36:53 +0000 Subject: [PATCH] Restricted warning message so that it is only displayed when the property has been set git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@151748 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/commons/logging/LogFactory.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/java/org/apache/commons/logging/LogFactory.java b/src/java/org/apache/commons/logging/LogFactory.java index fe07ec1..b40b8a9 100644 --- a/src/java/org/apache/commons/logging/LogFactory.java +++ b/src/java/org/apache/commons/logging/LogFactory.java @@ -42,7 +42,7 @@ import java.util.Properties; * @author Craig R. McClanahan * @author Costin Manolache * @author Richard A. Sitze - * @version $Revision: 1.28 $ $Date: 2004/11/10 22:59:04 $ + * @version $Revision: 1.28 $ $Date$ */ public abstract class LogFactory { @@ -115,7 +115,9 @@ public abstract class LogFactory { */ public static final String HASHTABLE_IMPLEMENTATION_PROPERTY = "org.apache.commons.logging.LogFactory.HashtableImpl"; - + /** Name used to load the weak hashtable implementation by names */ + private static final String WEAK_HASHTABLE_CLASSNAME = "org.apache.commons.logging.impl.WeakHashtable"; + // ----------------------------------------------------------- Constructors @@ -224,7 +226,7 @@ public abstract class LogFactory { String storeImplementationClass = System.getProperty(HASHTABLE_IMPLEMENTATION_PROPERTY); if (storeImplementationClass == null) { - storeImplementationClass = "org.apache.commons.logging.impl.WeakHashtable"; + storeImplementationClass = WEAK_HASHTABLE_CLASSNAME; } try { Class implementationClass = Class.forName(storeImplementationClass); @@ -232,7 +234,10 @@ public abstract class LogFactory { } catch (Exception e) { // ignore - System.err.println("[ERROR] LogFactory: Load of custom hashtable failed"); + if (!WEAK_HASHTABLE_CLASSNAME.equals(storeImplementationClass)) { + // if the user's trying to set up a custom implementation, give a clue + System.err.println("[ERROR] LogFactory: Load of custom hashtable failed"); + } } if (result == null) { result = new Hashtable();