Top Description Inners Fields Constructors Methods
org.apache.juli

public Class ClassLoaderLogManager

extends LogManager
Class Inheritance
Imports
java.io.File, .FileInputStream, .FilePermission, .IOException, .InputStream, java.net.URL, .URLClassLoader, java.security.AccessControlException, .AccessController, .Permission, .PrivilegedAction, java.util.Collections, .Enumeration, .HashMap, .Map, .Properties, .StringTokenizer, .WeakHashMap, java.util.concurrent.ConcurrentHashMap, java.util.logging.Handler, .Level, .LogManager, .Logger

Per classloader LogManager implementation. For light debugging, set the system property org.apache.juli.ClassLoaderLogManager.debug=true. Short configuration information will be sent to System.err.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
private class
protected static class
protected static class
ClassLoaderLogManager.RootLogger

This class is needed to instantiate the root of each per classloader hierarchy.

Field Summary

Modifier and TypeField and Description
private static ThreadLocal<Boolean>
protected final Map<ClassLoader, ClassLoaderLogManager.ClassLoaderLogInfo>
classLoaderLoggers

Map containing the classloader information, keyed per classloader.

public static final String
protected final ThreadLocal<String>
prefix

This prefix is used to allow using prefixes for the properties names of handlers and their subcomponents.

protected volatile boolean
useShutdownHook

Determines if the shutdown hook is used to perform any necessary clean-up such as flushing buffered handlers on JVM shutdown.

Inherited from java.util.logging.LogManager:
LOGGING_MXBEAN_NAME

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public synchronized boolean
addLogger(final Logger
The logger to be added
logger
)

Overrides java.util.logging.LogManager.addLogger.

Add the specified logger to the classloader local configuration.

protected static void
doSetParentLogger(final Logger
The logger
logger
,
final Logger
The parent logger
parent
)

Set parent child relationship between the two specified loggers.

private synchronized String
pack-priv static ClassLoader

Returns:

The class loader to use to lookup loggers, obtain configuration etc.
getClassLoader
()

Obtain the class loader to use to lookup loggers, obtain configuration etc. The search order is:

  1. Thread.currentThread().getContextClassLoader()
  2. The class laoder of this class
protected synchronized ClassLoaderLogManager.ClassLoaderLogInfo

Returns:

the log configuration
getClassLoaderInfo
(ClassLoader
The class loader for which we will retrieve or build the configuration
classLoader
)

Retrieve the configuration associated with the specified classloader.

public synchronized Logger
getLogger(final String
The name of the logger to retrieve
name
)

Overrides java.util.logging.LogManager.getLogger.

Get the logger associated with the specified name inside the classloader local configuration.

public synchronized Enumeration<String>
getLoggerNames()

Overrides java.util.logging.LogManager.getLoggerNames.

Get an enumeration of the logger names currently defined in the classloader local configuration.

public String
getProperty(String
The property name
name
)

Overrides java.util.logging.LogManager.getProperty.

Get the value of the specified property in the classloader local configuration.

public boolean
public void
readConfiguration()

Overrides java.util.logging.LogManager.readConfiguration.

Reads and initializes the logging configuration.

public void
readConfiguration(InputStream
stream to read properties from
is
)

Overrides java.util.logging.LogManager.readConfiguration.

Reads and initializes the logging configuration from the given input stream.

protected synchronized void
readConfiguration(ClassLoader
The classloader
classLoader
)

Read configuration for the specified classloader.

protected synchronized void
readConfiguration(InputStream
InputStream to the properties file
is
,
ClassLoader
for which the configuration will be loaded
classLoader
)

Load specified configuration.

protected String

Returns:

the modified string
replace
(String
The original string
str
)

System property replacement in the given string.

private String
public synchronized void
reset()

Overrides java.util.logging.LogManager.reset.

Reset the logging configuration.

private void
public void
setUseShutdownHook(boolean useShutdownHook)

public synchronized void
shutdown()

Shuts down the logging system.

Inherited from java.util.logging.LogManager:
addConfigurationListenercheckAccessgetLoggingMXBeangetLogManagerremoveConfigurationListenerupdateConfigurationupdateConfiguration

Field Detail

addingLocalRootLoggerback to summary
private static ThreadLocal<Boolean> addingLocalRootLogger
classLoaderLoggersback to summary
protected final Map<ClassLoader, ClassLoaderLogManager.ClassLoaderLogInfo> classLoaderLoggers

Map containing the classloader information, keyed per classloader. A weak hashmap is used to ensure no classloader reference is leaked from application redeployment.

DEBUG_PROPERTYback to summary
public static final String DEBUG_PROPERTY
prefixback to summary
protected final ThreadLocal<String> prefix

This prefix is used to allow using prefixes for the properties names of handlers and their subcomponents.

useShutdownHookback to summary
protected volatile boolean useShutdownHook

Determines if the shutdown hook is used to perform any necessary clean-up such as flushing buffered handlers on JVM shutdown. Defaults to true but may be set to false if another component ensures that shutdown() is called.

Constructor Detail

ClassLoaderLogManagerback to summary
public ClassLoaderLogManager()

Method Detail

addLoggerback to summary
public synchronized boolean addLogger(final Logger logger)

Overrides java.util.logging.LogManager.addLogger.

Add the specified logger to the classloader local configuration.

Parameters
logger:Logger

The logger to be added

Returns:boolean

Doc from java.util.logging.LogManager.addLogger.

true if the argument logger was registered successfully, false if a logger of that name already exists.

Annotations
@Override
doSetParentLoggerback to summary
protected static void doSetParentLogger(final Logger logger, final Logger parent)

Set parent child relationship between the two specified loggers.

Parameters
logger:Logger

The logger

parent:Logger

The parent logger

findPropertyback to summary
private synchronized String findProperty(String name)
getClassLoaderback to summary
pack-priv static ClassLoader getClassLoader()

Obtain the class loader to use to lookup loggers, obtain configuration etc. The search order is:

  1. Thread.currentThread().getContextClassLoader()
  2. The class laoder of this class
Returns:ClassLoader

The class loader to use to lookup loggers, obtain configuration etc.

getClassLoaderInfoback to summary
protected synchronized ClassLoaderLogManager.ClassLoaderLogInfo getClassLoaderInfo(ClassLoader classLoader)

Retrieve the configuration associated with the specified classloader. If it does not exist, it will be created. If no class loader is specified, the class loader used to load this class is used.

Parameters
classLoader:ClassLoader

The class loader for which we will retrieve or build the configuration

Returns:ClassLoaderLogManager.ClassLoaderLogInfo

the log configuration

getLoggerback to summary
public synchronized Logger getLogger(final String name)

Overrides java.util.logging.LogManager.getLogger.

Get the logger associated with the specified name inside the classloader local configuration. If this returns null, and the call originated for Logger.getLogger, a new logger with the specified name will be instantiated and added using addLogger.

Parameters
name:String

The name of the logger to retrieve

Returns:Logger

Doc from java.util.logging.LogManager.getLogger.

matching logger or null if none is found

Annotations
@Override
getLoggerNamesback to summary
public synchronized Enumeration<String> getLoggerNames()

Overrides java.util.logging.LogManager.getLoggerNames.

Get an enumeration of the logger names currently defined in the classloader local configuration.

Returns:Enumeration<String>

Doc from java.util.logging.LogManager.getLoggerNames.

enumeration of logger name strings

Annotations
@Override
getPropertyback to summary
public String getProperty(String name)

Overrides java.util.logging.LogManager.getProperty.

Get the value of the specified property in the classloader local configuration.

Parameters
name:String

The property name

Returns:String

Doc from java.util.logging.LogManager.getProperty.

property value

Annotations
@Override
isUseShutdownHookback to summary
public boolean isUseShutdownHook()
readConfigurationback to summary
public void readConfiguration() throws IOException, SecurityException

Overrides java.util.logging.LogManager.readConfiguration.

Doc from java.util.logging.LogManager.readConfiguration.

Reads and initializes the logging configuration.

If the "java.util.logging.config.class" system property is set, then the property value is treated as a class name. The given class will be loaded, an object will be instantiated, and that object's constructor is responsible for reading in the initial configuration. (That object may use other system properties to control its configuration.) The alternate configuration class can use readConfiguration(InputStream) to define properties in the LogManager.

If "java.util.logging.config.class" system property is not set, then this method will read the initial configuration from a properties file and calls the readConfiguration(InputStream) method to initialize the configuration. The "java.util.logging.config.file" system property can be used to specify the properties file that will be read as the initial configuration; if not set, then the LogManager default configuration is used. The default configuration is typically loaded from the properties file "conf/logging.properties" in the Java installation directory.

Any registered configuration listener will be invoked after the properties are read.

Annotations
@Override
Exceptions
IOException:
if there are IO problems reading the configuration.
SecurityException:
if a security manager exists and if the caller does not have LoggingPermission("control").
readConfigurationback to summary
public void readConfiguration(InputStream is) throws IOException, SecurityException

Overrides java.util.logging.LogManager.readConfiguration.

Doc from java.util.logging.LogManager.readConfiguration.

Reads and initializes the logging configuration from the given input stream.

Any registered configuration listener will be invoked after the properties are read.

Parameters
is:InputStream

stream to read properties from

Annotations
@Override
Exceptions
IOException:
if there are problems reading from the stream, or the given stream is not in the properties file format.
SecurityException:
if a security manager exists and if the caller does not have LoggingPermission("control").
readConfigurationback to summary
protected synchronized void readConfiguration(ClassLoader classLoader) throws IOException

Read configuration for the specified classloader.

Parameters
classLoader:ClassLoader

The classloader

Exceptions
IOException:
Error reading configuration
readConfigurationback to summary
protected synchronized void readConfiguration(InputStream is, ClassLoader classLoader) throws IOException

Load specified configuration.

Parameters
is:InputStream

InputStream to the properties file

classLoader:ClassLoader

for which the configuration will be loaded

Exceptions
IOException:
If something wrong happens during loading
replaceback to summary
protected String replace(String str)

System property replacement in the given string.

Parameters
str:String

The original string

Returns:String

the modified string

replaceWebApplicationPropertiesback to summary
private String replaceWebApplicationProperties(String propName)
resetback to summary
public synchronized void reset() throws SecurityException

Overrides java.util.logging.LogManager.reset.

Doc from java.util.logging.LogManager.reset.

Reset the logging configuration.

For all named loggers, the reset operation removes and closes all Handlers and (except for the root logger) sets the level to null. The root logger's level is set to Level.INFO.

Annotations
@Override
Exceptions
SecurityException:
if a security manager exists and if the caller does not have LoggingPermission("control").
resetLoggersback to summary
private void resetLoggers(ClassLoaderLogManager.ClassLoaderLogInfo clLogInfo)
setUseShutdownHookback to summary
public void setUseShutdownHook(boolean useShutdownHook)
shutdownback to summary
public synchronized void shutdown()

Shuts down the logging system.

org.apache.juli back to summary

protected final Class ClassLoaderLogManager.ClassLoaderLogInfo

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Map<String, Handler>
pack-priv final Map<String, Logger>
pack-priv final Properties
pack-priv final ClassLoaderLogManager.LogNode

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

handlersback to summary
pack-priv final Map<String, Handler> handlers
loggersback to summary
pack-priv final Map<String, Logger> loggers
propsback to summary
pack-priv final Properties props
rootNodeback to summary
pack-priv final ClassLoaderLogManager.LogNode rootNode

Constructor Detail

ClassLoaderLogInfoback to summary
pack-priv ClassLoaderLogInfo(final ClassLoaderLogManager.LogNode rootNode)
org.apache.juli back to summary

private final Class ClassLoaderLogManager.Cleaner

extends Thread
Class Inheritance

Field Summary

Inherited from java.lang.Thread:
MAX_PRIORITYMIN_PRIORITYNORM_PRIORITY

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

This method is run by the thread when it executes.

Inherited from java.lang.Thread:
activeCountcheckAccessclonecurrentThreaddumpStackenumerategetAllStackTracesgetContextClassLoadergetDefaultUncaughtExceptionHandlergetIdgetNamegetPrioritygetStackTracegetStategetThreadGroupgetUncaughtExceptionHandlerholdsLockinterruptinterruptedisAliveisDaemonisInterruptedisVirtualjoinjoinjoinjoinofPlatformofVirtualonSpinWaitsetContextClassLoadersetDaemonsetDefaultUncaughtExceptionHandlersetNamesetPrioritysetUncaughtExceptionHandlersleepsleepsleepstartstartVirtualThreadstopthreadIdtoStringyield

Constructor Detail

Cleanerback to summary
private Cleaner()

Method Detail

runback to summary
public void run()

Overrides java.lang.Thread.run.

Implements java.lang.Runnable.run.

Doc from java.lang.Thread.run.

This method is run by the thread when it executes. Subclasses of Thread may override this method.

This method is not intended to be invoked directly. If this thread is a platform thread created with a Runnable task then invoking this method will invoke the task's run method. If this thread is a virtual thread then invoking this method directly does nothing.

Annotations
@Override
org.apache.juli back to summary

protected final Class ClassLoaderLogManager.LogNode

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final Map<String, ClassLoaderLogManager.LogNode>
pack-priv Logger
pack-priv final ClassLoaderLogManager.LogNode

Constructor Summary

AccessConstructor and Description
pack-priv
LogNode(final ClassLoaderLogManager.LogNode parent, final Logger logger)

pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv ClassLoaderLogManager.LogNode
pack-priv Logger
pack-priv void
setParentLogger(final Logger parent)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

childrenback to summary
pack-priv final Map<String, ClassLoaderLogManager.LogNode> children
loggerback to summary
pack-priv Logger logger
parentback to summary
pack-priv final ClassLoaderLogManager.LogNode parent

Constructor Detail

LogNodeback to summary
pack-priv LogNode(final ClassLoaderLogManager.LogNode parent, final Logger logger)
LogNodeback to summary
pack-priv LogNode(final ClassLoaderLogManager.LogNode parent)

Method Detail

findNodeback to summary
pack-priv ClassLoaderLogManager.LogNode findNode(String name)
findParentLoggerback to summary
pack-priv Logger findParentLogger()
setParentLoggerback to summary
pack-priv void setParentLogger(final Logger parent)
org.apache.juli back to summary

protected Class ClassLoaderLogManager.RootLogger

extends Logger
Class Inheritance

This class is needed to instantiate the root of each per classloader hierarchy.

Field Summary

Inherited from java.util.logging.Logger:
globalGLOBAL_LOGGER_NAME

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.util.logging.Logger:
addHandlerconfigconfigenteringenteringenteringexitingexitingfinefinefinerfinerfinestfinestgetAnonymousLoggergetAnonymousLoggergetFiltergetGlobalgetHandlersgetLevelgetLoggergetLoggergetNamegetParentgetResourceBundlegetResourceBundleNamegetUseParentHandlersinfoinfoisLoggableloglogloglogloglogloglogplogplogplogplogplogplogrblogrblogrblogrblogrblogrblogrblogrbremoveHandlersetFiltersetLevelsetParentsetResourceBundlesetUseParentHandlerssevereseverethrowingwarningwarning

Constructor Detail

RootLoggerback to summary
public RootLogger()