diff --git a/src/java/org/apache/commons/logging/LogFactory.java b/src/java/org/apache/commons/logging/LogFactory.java index eb54bed..44a5e84 100644 --- a/src/java/org/apache/commons/logging/LogFactory.java +++ b/src/java/org/apache/commons/logging/LogFactory.java @@ -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 + "] "; } /** diff --git a/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java b/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java index 3f800b9..216def7 100644 --- a/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java +++ b/src/java/org/apache/commons/logging/impl/LogFactoryImpl.java @@ -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 + "] "; }