Consistent prefixes for diagnostics messages. Reduced length (to make more readable when used in container) by stripping package. Changed LogFactory to use OID for classloader.
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk@377184 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@@ -1263,21 +1263,21 @@ public abstract class LogFactory {
|
||||
// In order to avoid confusion where multiple instances of JCL are
|
||||
// being used via different classloaders within the same app, we
|
||||
// ensure each logged message has a prefix of form
|
||||
// LogFactory@12345:
|
||||
Class clazz = LogFactory.class;
|
||||
// [LogFactory --> classloader OID]
|
||||
// Note that this prefix should be kept consistent with that
|
||||
// in LogFactoryImpl
|
||||
String classLoaderName;
|
||||
try {
|
||||
ClassLoader classLoader = thisClassLoader;
|
||||
if (thisClassLoader == null) {
|
||||
classLoaderName = "BOOTLOADER";
|
||||
} else {
|
||||
classLoaderName = String.valueOf(System.identityHashCode(classLoader));
|
||||
classLoaderName = objectId(classLoader);
|
||||
}
|
||||
} catch(SecurityException e) {
|
||||
classLoaderName = "UNKNOWN";
|
||||
}
|
||||
diagnosticPrefix =
|
||||
clazz.getName() + "@" + classLoaderName + ": ";
|
||||
diagnosticPrefix = "[LogFactory -> " + classLoaderName + "] ";
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -460,9 +460,21 @@ public class LogFactoryImpl extends LogFactory {
|
||||
// see the context & impl ids from when this object was instantiated,
|
||||
// in order to link the impl id output as this object's prefix back to
|
||||
// the context it is intended to manage.
|
||||
// Note that this prefix should be kept consistent with that
|
||||
// in LogFactory.
|
||||
Class clazz = this.getClass();
|
||||
ClassLoader classLoader = getClassLoader(clazz);
|
||||
diagnosticPrefix = clazz.getName() + "@" + classLoader.toString() + ":";
|
||||
String classLoaderName;
|
||||
try {
|
||||
if (classLoader == null) {
|
||||
classLoaderName = "BOOTLOADER";
|
||||
} else {
|
||||
classLoaderName = objectId(classLoader);
|
||||
}
|
||||
} catch(SecurityException e) {
|
||||
classLoaderName = "UNKNOWN";
|
||||
}
|
||||
diagnosticPrefix = "[LogFactoryImpl -> " + classLoaderName + "] ";
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user