if (isDiagnosticsEnabled()) { logDiagnostic("Discovering a Log implementation..."); initConfiguration(); String specifiedLogClassName = findUserSpecifiedLogClassName(); if (isDiagnosticsEnabled()) { logDiagnostic("Attempting to load user-specified log class '" + specifiedLogClassName + "'..."); result = createLogFromClass(specifiedLogClassName, logCategory, true); informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_LOG4J_LOGGER); informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_JDK14_LOGGER); informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_LUMBERJACK_LOGGER); informUponSimilarName(messageBuffer, specifiedLogClassName, LOGGING_IMPL_SIMPLE_LOGGER); throw new LogConfigurationException(messageBuffer.toString()); if (isDiagnosticsEnabled()) { logDiagnostic( "No user-specified Log implementation; performing discovery" + " using the standard supported logging implementations..."); result = createLogFromClass(classesToDiscover[i], logCategory, true);
/** * Return the fully qualified Java classname of the {@link Log} * implementation we will be using. * * @deprecated Never invoked by this class; subclasses should not assume * it will be. */ protected String getLogClassName() { if (logClassName == null) { discoverLogImplementation(getClass().getName()); } return logClassName; }
if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] Trying to get configuration for item " + property); Object valueObj = getAttribute(property); if (valueObj != null) { if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] Found LogFactory attribute [" + valueObj + "] for " + property); if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] No LogFactory attribute found for " + property); String value = System.getProperty(property); if (value != null) { if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] Found system property [" + value + "] for " + property); if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] No system property found for property " + property); if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] Security prevented reading system property " + property); if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] No configuration defined for item " + property);
if (isDiagnosticsEnabled()) { logDiagnostic("Checking for '" + name + "'."); Log log = createLogFromClass( classname, this.getClass().getName(), // dummy category if (isDiagnosticsEnabled()) { logDiagnostic("Did not find '" + name + "'."); if (isDiagnosticsEnabled()) { logDiagnostic("Found '" + name + "'."); if (isDiagnosticsEnabled()) { logDiagnostic("Logging system '" + name + "' is available but not useable.");
if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] Trying to get configuration for item " + property); Object valueObj = getAttribute(property); if (valueObj != null) { if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] Found LogFactory attribute [" + valueObj + "] for " + property); if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] No LogFactory attribute found for " + property); String value = getSystemProperty(property, null); if (value != null) { if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] Found system property [" + value + "] for " + property); if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] No system property found for property " + property); if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] Security prevented reading system property " + property); if (isDiagnosticsEnabled()) { logDiagnostic("[ENV] No configuration defined for item " + property);
ClassLoader classLoader = getClassLoader(clazz); String classLoaderName; try { classLoaderName = "BOOTLOADER"; } else { classLoaderName = objectId(classLoader);
if (isDiagnosticsEnabled()) { logDiagnostic("Attempting to instantiate '" + logAdapterClassName + "'"); ClassLoader currentCL = getBaseClassLoader(); logDiagnostic( "Trying to load '" + logAdapterClassName + "' from classloader " + objectId(currentCL)); try { if (isDiagnosticsEnabled()) { logDiagnostic("Class '" + logAdapterClassName + "' [" + resourceName + "] cannot be found."); } else { logDiagnostic("Class '" + logAdapterClassName + "' was found at '" + url + "'"); logDiagnostic( "The log adapter '" + logAdapterClassName + "' is not available via classloader " + objectId(currentCL) + ": " + msg.trim()); logDiagnostic( "The log adapter '" + logAdapterClassName
ClassLoader thisClassLoader = getClassLoader(LogFactoryImpl.class); ClassLoader contextClassLoader = getContextClassLoader(); ClassLoader baseClassLoader = getLowestClassLoader( contextClassLoader, thisClassLoader); if (isDiagnosticsEnabled()) { logDiagnostic( "[WARNING] the context classloader is not part of a" + " parent-child relationship with the classloader that" if (isDiagnosticsEnabled()) { logDiagnostic( "Warning: the context classloader is an ancestor of the" + " classloader that loaded LogFactoryImpl; it should be"
if (isDiagnosticsEnabled()) { logDiagnostic("Attempting to instantiate '" + logAdapterClassName + "'"); ClassLoader currentCL = getBaseClassLoader(); logDiagnostic("Trying to load '" + logAdapterClassName + "' from classloader " + objectId(currentCL)); try { if (isDiagnosticsEnabled()) { logDiagnostic("Class '" + logAdapterClassName + "' [" + resourceName + "] cannot be found."); } else { logDiagnostic("Class '" + logAdapterClassName + "' was found at '" + url + "'"); logDiagnostic("The log adapter '" + logAdapterClassName + "' is not available via classloader " + objectId(currentCL) + ": " + msg.trim()); try { logDiagnostic("The log adapter '" + logAdapterClassName + "' is not available via the LogFactoryImpl class classloader: " + msg.trim()); break; handleFlawedHierarchy(currentCL, c); } catch (NoClassDefFoundError e) { logDiagnostic("The log adapter '" + logAdapterClassName + "' is missing dependencies when loaded via classloader " + objectId(currentCL) + ": " + msg.trim()); break;
ClassLoader thisClassLoader = getClassLoader(LogFactoryImpl.class); ClassLoader contextClassLoader = getContextClassLoaderInternal(); ClassLoader baseClassLoader = getLowestClassLoader( contextClassLoader, thisClassLoader); if (isDiagnosticsEnabled()) { logDiagnostic("[WARNING] the context classloader is not part of a" + " parent-child relationship with the classloader that" + " loaded LogFactoryImpl."); if (isDiagnosticsEnabled()) { logDiagnostic( "Warning: the context classloader is an ancestor of the" + " classloader that loaded LogFactoryImpl; it should be" +
if (isDiagnosticsEnabled()) { try { ClassLoader logInterfaceClassLoader = getClassLoader(Log.class); logDiagnostic("Class '" + badClass.getName() + "' was found in classloader " + objectId(badClassLoader) + ". It is bound to a Log interface which is not" + " the one loaded from classloader " + objectId(logInterfaceClassLoader)); } catch (Throwable t) { handleThrowable(t); // may re-throw t logDiagnostic("Error while trying to output diagnostics about" + " bad class '" + badClass + "'"); msg.append(Log.class.getName()); msg.append("' visible."); if (isDiagnosticsEnabled()) { logDiagnostic(msg.toString()); if (isDiagnosticsEnabled()) { StringBuffer msg = new StringBuffer(); msg.append("Warning: bad log hierarchy. "); msg.append(Log.class.getName()); msg.append("' visible."); logDiagnostic(msg.toString()); msg.append(badClass.getName()); msg.append("' does not implement the Log interface."); if (isDiagnosticsEnabled()) { logDiagnostic(msg.toString()); if (isDiagnosticsEnabled()) {
/** * Initialize a number of variables that control the behaviour of this * class and that can be tweaked by the user. This is done when the first * logger is created, not in the constructor of this class, because we * need to give the user a chance to call method setAttribute in order to * configure this object. */ private void initConfiguration() { allowFlawedContext = getBooleanConfiguration(ALLOW_FLAWED_CONTEXT_PROPERTY, true); allowFlawedDiscovery = getBooleanConfiguration(ALLOW_FLAWED_DISCOVERY_PROPERTY, true); allowFlawedHierarchy = getBooleanConfiguration(ALLOW_FLAWED_HIERARCHY_PROPERTY, true); }
/** * Convenience method to derive a name from the specified class and * call <code>getInstance(String)</code> with it. * * @param clazz Class for which a suitable Log name will be derived * * @exception LogConfigurationException if a suitable <code>Log</code> * instance cannot be returned */ public Log getInstance(Class clazz) throws LogConfigurationException { return getInstance(clazz.getName()); }
/** * Get the setting for the user-configurable behaviour specified by key. * If nothing has explicitly been set, then return dflt. */ private boolean getBooleanConfiguration(String key, boolean dflt) { String val = getConfigurationValue(key); if (val == null) { return dflt; } return Boolean.valueOf(val).booleanValue(); }
if (isDiagnosticsEnabled()) { try { ClassLoader logInterfaceClassLoader = getClassLoader(Log.class); logDiagnostic( "Class '" + badClass.getName() + "' was found in classloader " + objectId(logInterfaceClassLoader)); } catch (Throwable t) { logDiagnostic( "Error while trying to output diagnostics about" + " bad class '" + badClass + "'"); msg.append(Log.class.getName()); msg.append("' visible."); if (isDiagnosticsEnabled()) { logDiagnostic(msg.toString()); if (isDiagnosticsEnabled()) { StringBuffer msg = new StringBuffer(); msg.append("Warning: bad log hierarchy. "); msg.append(Log.class.getName()); msg.append("' visible."); logDiagnostic(msg.toString()); msg.append(badClass.getName()); msg.append("' does not implement the Log interface."); if (isDiagnosticsEnabled()) {
try { if (logConstructor == null) { instance = discoverLogImplementation(name); throw new LogConfigurationException(c == null ? e : c); } catch (Throwable t) { handleThrowable(t); // may re-throw t
ClassLoader classLoader = getClassLoader(clazz); String classLoaderName; try {
if (isDiagnosticsEnabled()) { logDiagnostic("Attempting to instantiate '" + logAdapterClassName + "'"); ClassLoader currentCL = getBaseClassLoader(); logDiagnostic( "Trying to load '" + logAdapterClassName + objectId(currentCL)); try { if (isDiagnosticsEnabled()) { logDiagnostic("Class '" + logAdapterClassName + "' [" + resourceName + "] cannot be found."); } else { logDiagnostic("Class '" + logAdapterClassName + "' was found at '" + url + "'"); logDiagnostic( "The log adapter '" + logAdapterClassName logDiagnostic( "The log adapter '" + logAdapterClassName handleFlawedHierarchy(currentCL, c); } catch (NoClassDefFoundError e) { logDiagnostic(
ClassLoader thisClassLoader = getClassLoader(LogFactoryImpl.class); ClassLoader contextClassLoader = getContextClassLoader(); ClassLoader baseClassLoader = getLowestClassLoader( contextClassLoader, thisClassLoader); if (isDiagnosticsEnabled()) { logDiagnostic( "[WARNING] the context classloader is not part of a" + " parent-child relationship with the classloader that" if (isDiagnosticsEnabled()) { logDiagnostic( "Warning: the context classloader is an ancestor of the" + " classloader that loaded LogFactoryImpl; it should be"
if (isDiagnosticsEnabled()) { logDiagnostic("Attempting to instantiate '" + logAdapterClassName + "'"); ClassLoader currentCL = getBaseClassLoader(); logDiagnostic("Trying to load '" + logAdapterClassName + "' from classloader " + objectId(currentCL)); try { if (isDiagnosticsEnabled()) { logDiagnostic("Class '" + logAdapterClassName + "' [" + resourceName + "] cannot be found."); } else { logDiagnostic("Class '" + logAdapterClassName + "' was found at '" + url + "'"); logDiagnostic("The log adapter '" + logAdapterClassName + "' is not available via classloader " + objectId(currentCL) + ": " + msg.trim()); try { logDiagnostic("The log adapter '" + logAdapterClassName + "' is not available via the LogFactoryImpl class classloader: " + msg.trim()); break; handleFlawedHierarchy(currentCL, c); } catch (NoClassDefFoundError e) { logDiagnostic("The log adapter '" + logAdapterClassName + "' is missing dependencies when loaded via classloader " + objectId(currentCL) + ": " + msg.trim()); break;