1
0

Modify the logger discovery contract to perform the complete set of checks

even in environments (such as an Applet) where System.getProperty() throws
a security exception.  Previously, this was causing the checks for Log4J or
JDK 1.4 logging to be skipped.

PR:  Bugzilla #7468
Reported By:  Tim Vernum (tpv at spamcop.net)


git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@138881 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Craig R. McClanahan
2002-03-31 00:31:49 +00:00
parent 4487056de8
commit 6bafa3f510

View File

@@ -1,7 +1,7 @@
/* /*
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java,v 1.6 2002/02/27 18:01:41 craigmcc Exp $ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//logging/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java,v 1.7 2002/03/31 00:31:49 craigmcc Exp $
* $Revision: 1.6 $ * $Revision: 1.7 $
* $Date: 2002/02/27 18:01:41 $ * $Date: 2002/03/31 00:31:49 $
* *
* ==================================================================== * ====================================================================
* *
@@ -104,7 +104,7 @@ import org.apache.commons.logging.LogSource;
* *
* @author Rod Waldhoff * @author Rod Waldhoff
* @author Craig R. McClanahan * @author Craig R. McClanahan
* @version $Revision: 1.6 $ $Date: 2002/02/27 18:01:41 $ * @version $Revision: 1.7 $ $Date: 2002/03/31 00:31:49 $
*/ */
public class LogFactoryImpl extends LogFactory { public class LogFactoryImpl extends LogFactory {
@@ -367,29 +367,36 @@ public class LogFactoryImpl extends LogFactory {
// Identify the Log implementation class we will be using // Identify the Log implementation class we will be using
String logClassName = null; String logClassName = null;
try { if (logClassName == null) {
logClassName = (String) getAttribute(LOG_PROPERTY); logClassName = (String) getAttribute(LOG_PROPERTY);
if (logClassName == null) { // @deprecated }
logClassName = (String) getAttribute(LOG_PROPERTY_OLD); if (logClassName == null) { // @deprecated
} logClassName = (String) getAttribute(LOG_PROPERTY_OLD);
if (logClassName == null) { }
if (logClassName == null) {
try {
logClassName = System.getProperty(LOG_PROPERTY); logClassName = System.getProperty(LOG_PROPERTY);
} catch (SecurityException e) {
;
} }
if (logClassName == null) { // @deprecated }
if (logClassName == null) { // @deprecated
try {
logClassName = System.getProperty(LOG_PROPERTY_OLD); logClassName = System.getProperty(LOG_PROPERTY_OLD);
} catch (SecurityException e) {
;
} }
if ((logClassName == null) && isLog4JAvailable()) { }
logClassName = if ((logClassName == null) && isLog4JAvailable()) {
"org.apache.commons.logging.impl.Log4JCategoryLog"; logClassName =
} "org.apache.commons.logging.impl.Log4JCategoryLog";
if ((logClassName == null) && isJdk14Available()) { }
logClassName = if ((logClassName == null) && isJdk14Available()) {
"org.apache.commons.logging.impl.Jdk14Logger"; logClassName =
} "org.apache.commons.logging.impl.Jdk14Logger";
if (logClassName == null) { }
logClassName = LOG_DEFAULT; if (logClassName == null) {
} logClassName = LOG_DEFAULT;
} catch (SecurityException e) {
} }
// Attempt to load the Log implementation class // Attempt to load the Log implementation class