public class ContextLogManager extends LogManager
| Modifier and Type | Class and Description |
|---|---|
protected static class |
ContextLogManager.ClassLoaderLogInfo |
protected static class |
ContextLogManager.LogNode |
protected class |
ContextLogManager.RootLogger
This class is needed to instantiate the root of each per classloader
hierarchy.
|
| Modifier and Type | Field and Description |
|---|---|
protected Map<ClassLoader,ContextLogManager.ClassLoaderLogInfo> |
classLoaderLoggers
Map containing the classloader information, keyed per classloader.
|
static String |
LOG_CONF_FILE |
static String |
LOG_PROPS |
protected ThreadLocal<String> |
prefix
This prefix is used to allow using prefixes for the properties names
of handlers and their subcomponents.
|
protected boolean |
useShutdownHook
Determines if the shutdown hook is used to perform any necessary
clean-up such as flushing buffered handlers on JVM shutdown.
|
LOGGING_MXBEAN_NAME| Constructor and Description |
|---|
ContextLogManager() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
addLogger(Logger logger)
Add the specified logger to the classloader local configuration.
|
protected void |
configureHandler(String handlerName,
Handler handler)
should set level, formatter, filter
|
protected static void |
doSetParentLogger(Logger logger,
Logger parent)
Set parent child relationship between the two specified loggers.
|
boolean |
getBooleanProperty(String name,
boolean defaultValue) |
protected ContextLogManager.ClassLoaderLogInfo |
getClassLoaderInfo(ClassLoader classLoader)
Retrieve the configuration associated with the specified classloader.
|
Filter |
getFilterProperty(String name,
Filter defaultValue) |
Formatter |
getFormatterProperty(String name,
Formatter defaultValue) |
int |
getIntProperty(String name,
int defaultValue) |
Level |
getLevelProperty(String name,
Level defaultValue) |
Logger |
getLogger(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.
|
String |
getProperty(String name)
Get the value of the specified property in the classloader local
configuration.
|
String |
getStringProperty(String name,
String defaultValue) |
static Optional<LogManager> |
getSystemLoaderLogManager() |
boolean |
isUseShutdownHook() |
static Formatter |
loaderGetFormatterProperty(String name,
Formatter defaultValue) |
static int |
loaderGetIntProperty(String name,
int defaultValue) |
static Level |
loaderGetLevelProperty(String name,
Level defaultValue) |
static String |
loaderGetProperty(String name) |
static String |
loaderGetStringProperty(String name,
String defaultValue) |
void |
readConfiguration() |
protected void |
readConfiguration(ClassLoader classLoader)
Read configuration for the specified classloader.
|
void |
readConfiguration(Properties properties) |
protected void |
readConfiguration(Properties properties,
ClassLoader classLoader)
Load specified configuration.
|
protected String |
replace(String str,
Properties props)
System property replacement in the given string.
|
void |
reset() |
void |
setUseShutdownHook(boolean useShutdownHook) |
void |
shutdown()
Shuts down the logging system.
|
addPropertyChangeListener, checkAccess, getLoggingMXBean, getLogManager, readConfiguration, removePropertyChangeListenerpublic static final String LOG_PROPS
public static final String LOG_CONF_FILE
protected final Map<ClassLoader,ContextLogManager.ClassLoaderLogInfo> classLoaderLoggers
protected ThreadLocal<String> prefix
protected volatile boolean useShutdownHook
true but may be set to false if another component ensures
that shutdown() is called.public static Optional<LogManager> getSystemLoaderLogManager()
public boolean isUseShutdownHook()
public void setUseShutdownHook(boolean useShutdownHook)
public boolean addLogger(Logger logger)
addLogger in class LogManagerlogger - The logger to be addedpublic Logger getLogger(String name)
getLogger in class LogManagername - The name of the logger to retrievepublic Enumeration<String> getLoggerNames()
getLoggerNames in class LogManagerpublic String getProperty(String name)
getProperty in class LogManagername - The property namepublic static String loaderGetStringProperty(String name, String defaultValue)
public int getIntProperty(String name, int defaultValue)
public static int loaderGetIntProperty(String name, int defaultValue)
public boolean getBooleanProperty(String name, boolean defaultValue)
public static Formatter loaderGetFormatterProperty(String name, Formatter defaultValue)
public void readConfiguration()
throws IOException,
SecurityException
readConfiguration in class LogManagerIOExceptionSecurityExceptionpublic void readConfiguration(Properties properties) throws IOException, SecurityException
IOExceptionSecurityExceptionpublic void reset()
throws SecurityException
reset in class LogManagerSecurityExceptionpublic void shutdown()
protected ContextLogManager.ClassLoaderLogInfo getClassLoaderInfo(ClassLoader classLoader)
classLoader - The classloader for which we will retrieve or build the
configurationprotected void readConfiguration(ClassLoader classLoader) throws IOException
classLoader - IOException - Errotprotected void readConfiguration(Properties properties, ClassLoader classLoader) throws IOException
is - InputStream to the properties fileclassLoader - for which the configuration will be loadedIOException - If something wrong happens during loadingprotected void configureHandler(String handlerName, Handler handler)
handlerName - handler - protected static void doSetParentLogger(Logger logger, Logger parent)
logger - parent - protected String replace(String str, Properties props)
str - The original stringCopyright © 2014 LSST. All Rights Reserved.