Remove trailing spaces.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/logging/trunk@1432580 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -340,7 +340,6 @@ public abstract class LogFactory {
|
|||||||
try {
|
try {
|
||||||
Class implementationClass = Class.forName(storeImplementationClass);
|
Class implementationClass = Class.forName(storeImplementationClass);
|
||||||
result = (Hashtable) implementationClass.newInstance();
|
result = (Hashtable) implementationClass.newInstance();
|
||||||
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
// ignore
|
// ignore
|
||||||
if (!WEAK_HASHTABLE_CLASSNAME.equals(storeImplementationClass)) {
|
if (!WEAK_HASHTABLE_CLASSNAME.equals(storeImplementationClass)) {
|
||||||
@@ -365,10 +364,10 @@ public abstract class LogFactory {
|
|||||||
|
|
||||||
/** Utility method to safely trim a string. */
|
/** Utility method to safely trim a string. */
|
||||||
private static String trim(String src) {
|
private static String trim(String src) {
|
||||||
if (src == null) {
|
if (src == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return src.trim();
|
return src.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -422,8 +421,8 @@ public abstract class LogFactory {
|
|||||||
|
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic(
|
||||||
"[LOOKUP] LogFactory implementation requested for the first time for context classloader "
|
"[LOOKUP] LogFactory implementation requested for the first time for context classloader " +
|
||||||
+ objectId(contextClassLoader));
|
objectId(contextClassLoader));
|
||||||
logHierarchy("[LOOKUP] ", contextClassLoader);
|
logHierarchy("[LOOKUP] ", contextClassLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,35 +462,28 @@ public abstract class LogFactory {
|
|||||||
// Determine which concrete LogFactory subclass to use.
|
// Determine which concrete LogFactory subclass to use.
|
||||||
// First, try a global system property
|
// First, try a global system property
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic("[LOOKUP] Looking for system property [" + FACTORY_PROPERTY +
|
||||||
"[LOOKUP] Looking for system property [" + FACTORY_PROPERTY
|
"] to define the LogFactory subclass to use...");
|
||||||
+ "] to define the LogFactory subclass to use...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String factoryClass = getSystemProperty(FACTORY_PROPERTY, null);
|
String factoryClass = getSystemProperty(FACTORY_PROPERTY, null);
|
||||||
if (factoryClass != null) {
|
if (factoryClass != null) {
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic("[LOOKUP] Creating an instance of LogFactory class '" + factoryClass +
|
||||||
"[LOOKUP] Creating an instance of LogFactory class '" + factoryClass
|
"' as specified by system property " + FACTORY_PROPERTY);
|
||||||
+ "' as specified by system property " + FACTORY_PROPERTY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
factory = newFactory(factoryClass, baseClassLoader, contextClassLoader);
|
factory = newFactory(factoryClass, baseClassLoader, contextClassLoader);
|
||||||
} else {
|
} else {
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic("[LOOKUP] No system property [" + FACTORY_PROPERTY + "] defined.");
|
||||||
"[LOOKUP] No system property [" + FACTORY_PROPERTY
|
|
||||||
+ "] defined.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SecurityException e) {
|
} catch (SecurityException e) {
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic("[LOOKUP] A security exception occurred while trying to create an" +
|
||||||
"[LOOKUP] A security exception occurred while trying to create an"
|
" instance of the custom factory class" + ": [" + trim(e.getMessage()) +
|
||||||
+ " instance of the custom factory class"
|
"]. Trying alternative implementations...");
|
||||||
+ ": [" + trim(e.getMessage())
|
|
||||||
+ "]. Trying alternative implementations...");
|
|
||||||
}
|
}
|
||||||
// ignore
|
// ignore
|
||||||
} catch(RuntimeException e) {
|
} catch(RuntimeException e) {
|
||||||
@@ -501,11 +493,9 @@ public abstract class LogFactory {
|
|||||||
// One possible exception that can occur here is a ClassCastException when
|
// One possible exception that can occur here is a ClassCastException when
|
||||||
// the specified class wasn't castable to this LogFactory type.
|
// the specified class wasn't castable to this LogFactory type.
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic("[LOOKUP] An exception occurred while trying to create an" +
|
||||||
"[LOOKUP] An exception occurred while trying to create an"
|
" instance of the custom factory class" + ": [" + trim(e.getMessage()) +
|
||||||
+ " instance of the custom factory class"
|
"] as specified by a system property.");
|
||||||
+ ": [" + trim(e.getMessage())
|
|
||||||
+ "] as specified by a system property.");
|
|
||||||
}
|
}
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
@@ -518,9 +508,8 @@ public abstract class LogFactory {
|
|||||||
|
|
||||||
if (factory == null) {
|
if (factory == null) {
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic("[LOOKUP] Looking for a resource file of name [" + SERVICE_ID +
|
||||||
"[LOOKUP] Looking for a resource file of name [" + SERVICE_ID
|
"] to define the LogFactory subclass to use...");
|
||||||
+ "] to define the LogFactory subclass to use...");
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
InputStream is = getResourceAsStream(contextClassLoader,
|
InputStream is = getResourceAsStream(contextClassLoader,
|
||||||
@@ -542,20 +531,16 @@ public abstract class LogFactory {
|
|||||||
if (factoryClassName != null &&
|
if (factoryClassName != null &&
|
||||||
! "".equals(factoryClassName)) {
|
! "".equals(factoryClassName)) {
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic("[LOOKUP] Creating an instance of LogFactory class " + factoryClassName +
|
||||||
"[LOOKUP] Creating an instance of LogFactory class " + factoryClassName
|
" as specified by file '" + SERVICE_ID +
|
||||||
+ " as specified by file '" + SERVICE_ID
|
"' which was present in the path of the context classloader.");
|
||||||
+ "' which was present in the path of the context"
|
|
||||||
+ " classloader.");
|
|
||||||
}
|
}
|
||||||
factory = newFactory(factoryClassName, baseClassLoader, contextClassLoader );
|
factory = newFactory(factoryClassName, baseClassLoader, contextClassLoader );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// is == null
|
// is == null
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic("[LOOKUP] No resource file with name '" + SERVICE_ID + "' found.");
|
||||||
"[LOOKUP] No resource file with name '" + SERVICE_ID
|
|
||||||
+ "' found.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch( Exception ex ) {
|
} catch( Exception ex ) {
|
||||||
@@ -869,13 +854,11 @@ public abstract class LogFactory {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Are we running on a JDK 1.2 or later system?
|
// Are we running on a JDK 1.2 or later system?
|
||||||
Method method = Thread.class.getMethod("getContextClassLoader",
|
Method method = Thread.class.getMethod("getContextClassLoader", (Class[]) null);
|
||||||
(Class[]) null);
|
|
||||||
|
|
||||||
// Get the thread context class loader (if there is one)
|
// Get the thread context class loader (if there is one)
|
||||||
try {
|
try {
|
||||||
classLoader = (ClassLoader)method.invoke(Thread.currentThread(),
|
classLoader = (ClassLoader)method.invoke(Thread.currentThread(), (Object[]) null);
|
||||||
(Object[]) null);
|
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
throw new LogConfigurationException
|
throw new LogConfigurationException
|
||||||
("Unexpected IllegalAccessException", e);
|
("Unexpected IllegalAccessException", e);
|
||||||
@@ -920,7 +903,6 @@ public abstract class LogFactory {
|
|||||||
// + " classloader is the same as the class that loaded"
|
// + " classloader is the same as the class that loaded"
|
||||||
// + " the concrete LogFactory class.");
|
// + " the concrete LogFactory class.");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return the selected class loader
|
// Return the selected class loader
|
||||||
@@ -1040,16 +1022,13 @@ public abstract class LogFactory {
|
|||||||
if (result instanceof LogConfigurationException) {
|
if (result instanceof LogConfigurationException) {
|
||||||
LogConfigurationException ex = (LogConfigurationException) result;
|
LogConfigurationException ex = (LogConfigurationException) result;
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic("An error occurred while loading the factory class:" + ex.getMessage());
|
||||||
"An error occurred while loading the factory class:"
|
|
||||||
+ ex.getMessage());
|
|
||||||
}
|
}
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic("Created object " + objectId(result) + " to manage classloader " +
|
||||||
"Created object " + objectId(result)
|
objectId(contextClassLoader));
|
||||||
+ " to manage classloader " + objectId(contextClassLoader));
|
|
||||||
}
|
}
|
||||||
return (LogFactory)result;
|
return (LogFactory)result;
|
||||||
}
|
}
|
||||||
@@ -1234,9 +1213,7 @@ public abstract class LogFactory {
|
|||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic("Unable to create LogFactory instance.");
|
logDiagnostic("Unable to create LogFactory instance.");
|
||||||
}
|
}
|
||||||
if (logFactoryClass != null
|
if (logFactoryClass != null && !LogFactory.class.isAssignableFrom(logFactoryClass)) {
|
||||||
&& !LogFactory.class.isAssignableFrom(logFactoryClass)) {
|
|
||||||
|
|
||||||
return new LogConfigurationException(
|
return new LogConfigurationException(
|
||||||
"The chosen LogFactory implementation does not extend LogFactory."
|
"The chosen LogFactory implementation does not extend LogFactory."
|
||||||
+ " Please check your configuration.",
|
+ " Please check your configuration.",
|
||||||
@@ -1356,9 +1333,8 @@ public abstract class LogFactory {
|
|||||||
}
|
}
|
||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic("Exception while trying to find configuration file " +
|
||||||
"Exception while trying to find configuration file "
|
name + ":" + e.getMessage());
|
||||||
+ name + ":" + e.getMessage());
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
} catch(NoSuchMethodError e) {
|
} catch(NoSuchMethodError e) {
|
||||||
@@ -1512,13 +1488,9 @@ public abstract class LogFactory {
|
|||||||
|
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
if (props == null) {
|
if (props == null) {
|
||||||
logDiagnostic(
|
logDiagnostic("[LOOKUP] No properties file of name '" + fileName + "' found.");
|
||||||
"[LOOKUP] No properties file of name '" + fileName
|
|
||||||
+ "' found.");
|
|
||||||
} else {
|
} else {
|
||||||
logDiagnostic(
|
logDiagnostic("[LOOKUP] Properties file of name '" + fileName + "' found at '" + propsUrl + '"');
|
||||||
"[LOOKUP] Properties file of name '" + fileName
|
|
||||||
+ "' found at '" + propsUrl + '"');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1675,9 +1647,7 @@ public abstract class LogFactory {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logDiagnostic(
|
logDiagnostic("[ENV] Class " + className + " was loaded via classloader " + objectId(classLoader));
|
||||||
"[ENV] Class " + className + " was loaded via classloader "
|
|
||||||
+ objectId(classLoader));
|
|
||||||
logHierarchy("[ENV] Ancestry of classloader which loaded " + className + " is ", classLoader);
|
logHierarchy("[ENV] Ancestry of classloader which loaded " + className + " is ", classLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1701,8 +1671,7 @@ public abstract class LogFactory {
|
|||||||
try {
|
try {
|
||||||
systemClassLoader = ClassLoader.getSystemClassLoader();
|
systemClassLoader = ClassLoader.getSystemClassLoader();
|
||||||
} catch(SecurityException ex) {
|
} catch(SecurityException ex) {
|
||||||
logDiagnostic(
|
logDiagnostic(prefix + "Security forbids determining the system classloader.");
|
||||||
prefix + "Security forbids determining the system classloader.");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (classLoader != null) {
|
if (classLoader != null) {
|
||||||
|
|||||||
@@ -70,7 +70,9 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
/** Jdk14Logger class name */
|
/** Jdk14Logger class name */
|
||||||
private static final String LOGGING_IMPL_JDK14_LOGGER = "org.apache.commons.logging.impl.Jdk14Logger";
|
private static final String LOGGING_IMPL_JDK14_LOGGER = "org.apache.commons.logging.impl.Jdk14Logger";
|
||||||
/** Jdk13LumberjackLogger class name */
|
/** Jdk13LumberjackLogger class name */
|
||||||
private static final String LOGGING_IMPL_LUMBERJACK_LOGGER = "org.apache.commons.logging.impl.Jdk13LumberjackLogger";
|
private static final String LOGGING_IMPL_LUMBERJACK_LOGGER =
|
||||||
|
"org.apache.commons.logging.impl.Jdk13LumberjackLogger";
|
||||||
|
|
||||||
/** SimpleLog class name */
|
/** SimpleLog class name */
|
||||||
private static final String LOGGING_IMPL_SIMPLE_LOGGER = "org.apache.commons.logging.impl.SimpleLog";
|
private static final String LOGGING_IMPL_SIMPLE_LOGGER = "org.apache.commons.logging.impl.SimpleLog";
|
||||||
|
|
||||||
@@ -127,7 +129,7 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
* exception will be thrown and the app will fail to start. When set
|
* exception will be thrown and the app will fail to start. When set
|
||||||
* to true, discovery will continue (though the user might end up
|
* to true, discovery will continue (though the user might end up
|
||||||
* with a different logging implementation than they expected).
|
* with a different logging implementation than they expected).
|
||||||
*
|
* <p>
|
||||||
* Default behaviour: true (tolerates bad logging adapters)
|
* Default behaviour: true (tolerates bad logging adapters)
|
||||||
*
|
*
|
||||||
* See also method setAttribute.
|
* See also method setAttribute.
|
||||||
@@ -143,7 +145,7 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
* When set to false, an exception will be thrown and the app will fail
|
* When set to false, an exception will be thrown and the app will fail
|
||||||
* to start. When set to true, discovery will continue (though the user
|
* to start. When set to true, discovery will continue (though the user
|
||||||
* might end up with a different logging implementation than they expected).
|
* might end up with a different logging implementation than they expected).
|
||||||
*
|
* <p>
|
||||||
* Default behaviour: true (tolerates bad Log class hierarchy)
|
* Default behaviour: true (tolerates bad Log class hierarchy)
|
||||||
*
|
*
|
||||||
* See also method setAttribute.
|
* See also method setAttribute.
|
||||||
@@ -499,10 +501,10 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Return <code>true</code> if <em>JDK 1.4 or later</em> logging
|
* Return <code>true</code> if <em>JDK 1.4 or later</em> logging
|
||||||
* is available. Also checks that the <code>Throwable</code> class
|
* is available. Also checks that the <code>Throwable</code> class
|
||||||
* supports <code>getStackTrace()</code>, which is required by
|
* supports <code>getStackTrace()</code>, which is required by
|
||||||
* Jdk14Logger.</p>
|
* Jdk14Logger.
|
||||||
*
|
*
|
||||||
* @deprecated Never invoked by this class; subclasses should not assume
|
* @deprecated Never invoked by this class; subclasses should not assume
|
||||||
* it will be.
|
* it will be.
|
||||||
@@ -975,11 +977,7 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
for(;;) {
|
for(;;) {
|
||||||
// Loop through the classloader hierarchy trying to find
|
// Loop through the classloader hierarchy trying to find
|
||||||
// a viable classloader.
|
// a viable classloader.
|
||||||
logDiagnostic(
|
logDiagnostic("Trying to load '" + logAdapterClassName + "' from classloader " + objectId(currentCL));
|
||||||
"Trying to load '"
|
|
||||||
+ logAdapterClassName
|
|
||||||
+ "' from classloader "
|
|
||||||
+ objectId(currentCL));
|
|
||||||
try {
|
try {
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
// Show the location of the first occurrence of the .class file
|
// Show the location of the first occurrence of the .class file
|
||||||
@@ -1009,13 +1007,8 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
// in this or any ancestor classloader. There's no point in
|
// in this or any ancestor classloader. There's no point in
|
||||||
// trying higher up in the hierarchy in this case..
|
// trying higher up in the hierarchy in this case..
|
||||||
String msg = originalClassNotFoundException.getMessage();
|
String msg = originalClassNotFoundException.getMessage();
|
||||||
logDiagnostic(
|
logDiagnostic("The log adapter '" + logAdapterClassName + "' is not available via classloader " +
|
||||||
"The log adapter '"
|
objectId(currentCL) + ": " + msg.trim());
|
||||||
+ logAdapterClassName
|
|
||||||
+ "' is not available via classloader "
|
|
||||||
+ objectId(currentCL)
|
|
||||||
+ ": "
|
|
||||||
+ msg.trim());
|
|
||||||
try {
|
try {
|
||||||
// Try the class classloader.
|
// Try the class classloader.
|
||||||
// This may work in cases where the TCCL
|
// This may work in cases where the TCCL
|
||||||
@@ -1028,11 +1021,8 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
} catch (ClassNotFoundException secondaryClassNotFoundException) {
|
} catch (ClassNotFoundException secondaryClassNotFoundException) {
|
||||||
// no point continuing: this adapter isn't available
|
// no point continuing: this adapter isn't available
|
||||||
msg = secondaryClassNotFoundException.getMessage();
|
msg = secondaryClassNotFoundException.getMessage();
|
||||||
logDiagnostic(
|
logDiagnostic("The log adapter '" + logAdapterClassName +
|
||||||
"The log adapter '"
|
"' is not available via the LogFactoryImpl class classloader: " + msg.trim());
|
||||||
+ logAdapterClassName
|
|
||||||
+ "' is not available via the LogFactoryImpl class classloader: "
|
|
||||||
+ msg.trim());
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1068,13 +1058,9 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
// ancestor classloader. There's no point in trying higher up
|
// ancestor classloader. There's no point in trying higher up
|
||||||
// in the hierarchy in this case..
|
// in the hierarchy in this case..
|
||||||
String msg = e.getMessage();
|
String msg = e.getMessage();
|
||||||
logDiagnostic(
|
logDiagnostic("The log adapter '" + logAdapterClassName +
|
||||||
"The log adapter '"
|
"' is missing dependencies when loaded via classloader " + objectId(currentCL) +
|
||||||
+ logAdapterClassName
|
": " + msg.trim());
|
||||||
+ "' is missing dependencies when loaded via classloader "
|
|
||||||
+ objectId(currentCL)
|
|
||||||
+ ": "
|
|
||||||
+ msg.trim());
|
|
||||||
break;
|
break;
|
||||||
} catch (ExceptionInInitializerError e) {
|
} catch (ExceptionInInitializerError e) {
|
||||||
// A static initializer block or the initializer code associated
|
// A static initializer block or the initializer code associated
|
||||||
@@ -1084,13 +1070,9 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
// We treat this as meaning the adapter's underlying logging
|
// We treat this as meaning the adapter's underlying logging
|
||||||
// library could not be found.
|
// library could not be found.
|
||||||
String msg = e.getMessage();
|
String msg = e.getMessage();
|
||||||
logDiagnostic(
|
logDiagnostic("The log adapter '" + logAdapterClassName +
|
||||||
"The log adapter '"
|
"' is unable to initialize itself when loaded via classloader " + objectId(currentCL) +
|
||||||
+ logAdapterClassName
|
": " + msg.trim());
|
||||||
+ "' is unable to initialize itself when loaded via classloader "
|
|
||||||
+ objectId(currentCL)
|
|
||||||
+ ": "
|
|
||||||
+ msg.trim());
|
|
||||||
break;
|
break;
|
||||||
} catch(LogConfigurationException e) {
|
} catch(LogConfigurationException e) {
|
||||||
// call to handleFlawedHierarchy above must have thrown
|
// call to handleFlawedHierarchy above must have thrown
|
||||||
@@ -1121,21 +1103,15 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
try {
|
try {
|
||||||
this.logMethod = logAdapterClass.getMethod("setLogFactory",
|
this.logMethod = logAdapterClass.getMethod("setLogFactory",
|
||||||
logMethodSignature);
|
logMethodSignature);
|
||||||
logDiagnostic("Found method setLogFactory(LogFactory) in '"
|
logDiagnostic("Found method setLogFactory(LogFactory) in '" + logAdapterClassName + "'");
|
||||||
+ logAdapterClassName + "'");
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
this.logMethod = null;
|
this.logMethod = null;
|
||||||
logDiagnostic(
|
logDiagnostic("[INFO] '" + logAdapterClassName + "' from classloader " + objectId(currentCL) +
|
||||||
"[INFO] '" + logAdapterClassName
|
" does not declare optional method " + "setLogFactory(LogFactory)");
|
||||||
+ "' from classloader " + objectId(currentCL)
|
|
||||||
+ " does not declare optional method "
|
|
||||||
+ "setLogFactory(LogFactory)");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logDiagnostic(
|
logDiagnostic("Log adapter '" + logAdapterClassName + "' from classloader " +
|
||||||
"Log adapter '" + logAdapterClassName
|
objectId(logAdapterClass.getClassLoader()) + " has been selected for use.");
|
||||||
+ "' from classloader " + objectId(logAdapterClass.getClassLoader())
|
|
||||||
+ " has been selected for use.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return logAdapter;
|
return logAdapter;
|
||||||
@@ -1178,10 +1154,9 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
// forbidden it, just return the contextClassLoader.
|
// forbidden it, just return the contextClassLoader.
|
||||||
if (allowFlawedContext) {
|
if (allowFlawedContext) {
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic("[WARNING] the context classloader is not part of a" +
|
||||||
"[WARNING] the context classloader is not part of a"
|
" parent-child relationship with the classloader that" +
|
||||||
+ " parent-child relationship with the classloader that"
|
" loaded LogFactoryImpl.");
|
||||||
+ " loaded LogFactoryImpl.");
|
|
||||||
}
|
}
|
||||||
// If contextClassLoader were null, getLowestClassLoader() would
|
// If contextClassLoader were null, getLowestClassLoader() would
|
||||||
// have returned thisClassLoader. The fact we are here means
|
// have returned thisClassLoader. The fact we are here means
|
||||||
@@ -1189,10 +1164,9 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
return contextClassLoader;
|
return contextClassLoader;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
throw new LogConfigurationException(
|
throw new LogConfigurationException("Bad classloader hierarchy; LogFactoryImpl was loaded via" +
|
||||||
"Bad classloader hierarchy; LogFactoryImpl was loaded via"
|
" a classloader that is not related to the current context" +
|
||||||
+ " a classloader that is not related to the current context"
|
" classloader.");
|
||||||
+ " classloader.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1205,17 +1179,17 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
if (allowFlawedContext) {
|
if (allowFlawedContext) {
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic(
|
logDiagnostic(
|
||||||
"Warning: the context classloader is an ancestor of the"
|
"Warning: the context classloader is an ancestor of the" +
|
||||||
+ " classloader that loaded LogFactoryImpl; it should be"
|
" classloader that loaded LogFactoryImpl; it should be" +
|
||||||
+ " the same or a descendant. The application using"
|
" the same or a descendant. The application using" +
|
||||||
+ " commons-logging should ensure the context classloader"
|
" commons-logging should ensure the context classloader" +
|
||||||
+ " is used correctly.");
|
" is used correctly.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new LogConfigurationException(
|
throw new LogConfigurationException(
|
||||||
"Bad classloader hierarchy; LogFactoryImpl was loaded via"
|
"Bad classloader hierarchy; LogFactoryImpl was loaded via" +
|
||||||
+ " a classloader that is not related to the current context"
|
" a classloader that is not related to the current context" +
|
||||||
+ " classloader.");
|
" classloader.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1288,10 +1262,10 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
Throwable discoveryFlaw) {
|
Throwable discoveryFlaw) {
|
||||||
|
|
||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
logDiagnostic("Could not instantiate Log '"
|
logDiagnostic("Could not instantiate Log '" +
|
||||||
+ logAdapterClassName + "' -- "
|
logAdapterClassName + "' -- " +
|
||||||
+ discoveryFlaw.getClass().getName() + ": "
|
discoveryFlaw.getClass().getName() + ": " +
|
||||||
+ discoveryFlaw.getLocalizedMessage());
|
discoveryFlaw.getLocalizedMessage());
|
||||||
|
|
||||||
if (discoveryFlaw instanceof InvocationTargetException ) {
|
if (discoveryFlaw instanceof InvocationTargetException ) {
|
||||||
// Ok, the lib is there but while trying to create a real underlying
|
// Ok, the lib is there but while trying to create a real underlying
|
||||||
@@ -1326,7 +1300,7 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
* Report a problem loading the log adapter, then either return
|
* Report a problem loading the log adapter, then either return
|
||||||
* (if the situation is considered recoverable) or throw a
|
* (if the situation is considered recoverable) or throw a
|
||||||
* LogConfigurationException.
|
* LogConfigurationException.
|
||||||
* <p>
|
* <p>
|
||||||
* There are two possible reasons why we successfully loaded the
|
* There are two possible reasons why we successfully loaded the
|
||||||
* specified log adapter class then failed to cast it to a Log object:
|
* specified log adapter class then failed to cast it to a Log object:
|
||||||
* <ol>
|
* <ol>
|
||||||
@@ -1367,17 +1341,11 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
if (isDiagnosticsEnabled()) {
|
if (isDiagnosticsEnabled()) {
|
||||||
try {
|
try {
|
||||||
ClassLoader logInterfaceClassLoader = getClassLoader(Log.class);
|
ClassLoader logInterfaceClassLoader = getClassLoader(Log.class);
|
||||||
logDiagnostic(
|
logDiagnostic("Class '" + badClass.getName() + "' was found in classloader " +
|
||||||
"Class '" + badClass.getName()
|
objectId(badClassLoader) + ". It is bound to a Log interface which is not" +
|
||||||
+ "' was found in classloader "
|
" the one loaded from classloader " + objectId(logInterfaceClassLoader));
|
||||||
+ objectId(badClassLoader)
|
|
||||||
+ ". It is bound to a Log interface which is not"
|
|
||||||
+ " the one loaded from classloader "
|
|
||||||
+ objectId(logInterfaceClassLoader));
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
logDiagnostic(
|
logDiagnostic("Error while trying to output diagnostics about" + " bad class '" + badClass + "'");
|
||||||
"Error while trying to output diagnostics about"
|
|
||||||
+ " bad class '" + badClass + "'");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -598,8 +598,7 @@ public class SimpleLog implements Log, Serializable {
|
|||||||
|
|
||||||
// Get the thread context class loader (if there is one)
|
// Get the thread context class loader (if there is one)
|
||||||
try {
|
try {
|
||||||
classLoader = (ClassLoader)method.invoke(Thread.currentThread(),
|
classLoader = (ClassLoader)method.invoke(Thread.currentThread(), (Class[]) null);
|
||||||
(Class[]) null);
|
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
// ignore
|
// ignore
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
|
|||||||
@@ -15,7 +15,6 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
package org.apache.commons.logging.impl;
|
package org.apache.commons.logging.impl;
|
||||||
|
|
||||||
import java.lang.ref.ReferenceQueue;
|
import java.lang.ref.ReferenceQueue;
|
||||||
@@ -143,7 +142,6 @@ public final class WeakHashtable extends Hashtable {
|
|||||||
*/
|
*/
|
||||||
public WeakHashtable() {}
|
public WeakHashtable() {}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*@see Hashtable
|
*@see Hashtable
|
||||||
*/
|
*/
|
||||||
@@ -207,7 +205,6 @@ public final class WeakHashtable extends Hashtable {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*@see Hashtable
|
*@see Hashtable
|
||||||
*/
|
*/
|
||||||
@@ -341,7 +338,6 @@ public final class WeakHashtable extends Hashtable {
|
|||||||
* has been garbage collected.
|
* has been garbage collected.
|
||||||
*/
|
*/
|
||||||
private void purgeOne() {
|
private void purgeOne() {
|
||||||
|
|
||||||
synchronized (queue) {
|
synchronized (queue) {
|
||||||
WeakKey key = (WeakKey) queue.poll();
|
WeakKey key = (WeakKey) queue.poll();
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
@@ -395,7 +391,6 @@ public final class WeakHashtable extends Hashtable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Wrapper giving correct symantics for equals and hashcode */
|
/** Wrapper giving correct symantics for equals and hashcode */
|
||||||
private final static class Referenced {
|
private final static class Referenced {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user