org.apache.juli

Class ClassLoaderLogManager

public class ClassLoaderLogManager extends LogManager

Per classloader LogManager implementation.
Nested Class Summary
protected static classClassLoaderLogManager.ClassLoaderLogInfo
protected static classClassLoaderLogManager.LogNode
protected classClassLoaderLogManager.RootLogger
This class is needed to instantiate the root of each per classloader hierarchy.
Field Summary
protected Map<ClassLoader,ClassLoaderLogManager.ClassLoaderLogInfo>classLoaderLoggers
Map containing the classloader information, keyed per classloader.
protected ThreadLocal<String>prefix
This prefix is used to allow using prefixes for the properties names of handlers and their subcomponents.
Constructor Summary
ClassLoaderLogManager()
Method Summary
booleanaddLogger(Logger logger)
Add the specified logger to the classloader local configuration.
protected static voiddoSetParentLogger(Logger logger, Logger parent)
Set parent child relationship between the two specified loggers.
protected ClassLoaderLogManager.ClassLoaderLogInfogetClassLoaderInfo(ClassLoader classLoader)
Retrieve the configuration associated with the specified classloader.
LoggergetLogger(String name)
Get the logger associated with the specified name inside the classloader local configuration.
Enumeration<String>getLoggerNames()
Get an enumeration of the logger names currently defined in the classloader local configuration.
StringgetProperty(String name)
Get the value of the specified property in the classloader local configuration.
voidreadConfiguration()
voidreadConfiguration(InputStream is)
protected voidreadConfiguration(ClassLoader classLoader)
Read configuration for the specified classloader.
protected voidreadConfiguration(InputStream is, ClassLoader classLoader)
Load specified configuration.
protected Stringreplace(String str)
System property replacement in the given string.

Field Detail

classLoaderLoggers

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.

prefix

protected ThreadLocal<String> prefix
This prefix is used to allow using prefixes for the properties names of handlers and their subcomponents.

Constructor Detail

ClassLoaderLogManager

public ClassLoaderLogManager()

Method Detail

addLogger

public boolean addLogger(Logger logger)
Add the specified logger to the classloader local configuration.

Parameters: logger The logger to be added

doSetParentLogger

protected static void doSetParentLogger(Logger logger, Logger parent)
Set parent child relationship between the two specified loggers.

Parameters: logger parent

getClassLoaderInfo

protected ClassLoaderLogManager.ClassLoaderLogInfo getClassLoaderInfo(ClassLoader classLoader)
Retrieve the configuration associated with the specified classloader. If it does not exist, it will be created.

Parameters: classLoader The classloader for which we will retrieve or build the configuration

getLogger

public Logger getLogger(String name)
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 The name of the logger to retrieve

getLoggerNames

public Enumeration<String> getLoggerNames()
Get an enumeration of the logger names currently defined in the classloader local configuration.

getProperty

public String getProperty(String name)
Get the value of the specified property in the classloader local configuration.

Parameters: name The property name

readConfiguration

public void readConfiguration()

readConfiguration

public void readConfiguration(InputStream is)

readConfiguration

protected void readConfiguration(ClassLoader classLoader)
Read configuration for the specified classloader.

Parameters: classLoader

Throws: IOException Errot

readConfiguration

protected void readConfiguration(InputStream is, ClassLoader classLoader)
Load specified configuration.

Parameters: is InputStream to the properties file classLoader for which the configuration will be loaded

Throws: IOException If something wrong happens during loading

replace

protected String replace(String str)
System property replacement in the given string.

Parameters: str The original string

Returns: the modified string

Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.