Add feature to disable loading of Log implementations from the TCCL.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@370030 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -159,6 +159,11 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
|
|
||||||
// ----------------------------------------------------- Instance Variables
|
// ----------------------------------------------------- Instance Variables
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether logging classes should be loaded using the thread-context
|
||||||
|
* classloader, or via the classloader that loaded this LogFactoryImpl class.
|
||||||
|
*/
|
||||||
|
private boolean useTCCL = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The string prefixed to every message output by the logDiagnostic method.
|
* The string prefixed to every message output by the logDiagnostic method.
|
||||||
@@ -376,6 +381,10 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
attributes.put(name, value);
|
attributes.put(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (name.equals(TCCL_KEY)) {
|
||||||
|
useTCCL = Boolean.valueOf(value.toString()).booleanValue();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -699,7 +708,6 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
String specifiedLogClassName = findUserSpecifiedLogClassName();
|
String specifiedLogClassName = findUserSpecifiedLogClassName();
|
||||||
|
|
||||||
if (specifiedLogClassName != null) {
|
if (specifiedLogClassName != null) {
|
||||||
// note: createLogFromClass never returns null..
|
|
||||||
result = createLogFromClass(specifiedLogClassName,
|
result = createLogFromClass(specifiedLogClassName,
|
||||||
logCategory,
|
logCategory,
|
||||||
true);
|
true);
|
||||||
@@ -969,9 +977,14 @@ public class LogFactoryImpl extends LogFactory {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private ClassLoader getBaseClassLoader() throws LogConfigurationException {
|
private ClassLoader getBaseClassLoader() throws LogConfigurationException {
|
||||||
ClassLoader contextClassLoader = getContextClassLoader();
|
|
||||||
ClassLoader thisClassLoader = getClassLoader(LogFactoryImpl.class);
|
ClassLoader thisClassLoader = getClassLoader(LogFactoryImpl.class);
|
||||||
|
|
||||||
|
if (useTCCL == false) {
|
||||||
|
return thisClassLoader;
|
||||||
|
}
|
||||||
|
|
||||||
|
ClassLoader contextClassLoader = getContextClassLoader();
|
||||||
|
|
||||||
ClassLoader baseClassLoader = getLowestClassLoader(
|
ClassLoader baseClassLoader = getLowestClassLoader(
|
||||||
contextClassLoader, thisClassLoader);
|
contextClassLoader, thisClassLoader);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user