Package org.jboss.logmanager
Class LogManager
- java.lang.Object
-
- java.util.logging.LogManager
-
- org.jboss.logmanager.LogManager
-
public final class LogManager extends java.util.logging.LogManagerSimplified log manager. Designed to work around the (many) design flaws of the JDK platform log manager.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classLogManager.KnownLevelBuilderprivate static classLogManager.LocalFilterHolderprivate static classLogManager.ReadOnlyArrayList<T>private static classLogManager.ReadOnlyHashMap<K,V>private static classLogManager.ReadOnlyMapEntry<K,V>
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicBooleanconfigured(package private) static booleanPER_THREAD_LOG_FILTERstatic java.lang.StringPER_THREAD_LOG_FILTER_KEY
-
Constructor Summary
Constructors Constructor Description LogManager()Construct a new logmanager instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddLogger(java.util.logging.Logger logger)Do nothing.voidaddPropertyChangeListener(java.beans.PropertyChangeListener l)Do nothing.(package private) static <T> Tconstruct(java.lang.Class<? extends T> type, java.lang.String className)LoggergetLogger(java.lang.String name)Get or create a logger with the given name.java.util.Enumeration<java.lang.String>getLoggerNames()java.lang.StringgetProperty(java.lang.String name)Does nothing.static java.util.logging.FiltergetThreadLocalLogFilter()Returns the currently set filter for this thread ornullif one has not been set.voidreadConfiguration()Configure the log manager one time.voidreadConfiguration(java.io.InputStream inputStream)Configure the log manager.voidremovePropertyChangeListener(java.beans.PropertyChangeListener l)Do nothing.voidreset()Does nothing.static voidsetThreadLocalLogLevel(java.util.logging.Filter filter)Sets the filter on the thread for all loggers.private static java.lang.StringtryGetProperty(java.lang.String name, java.lang.String defaultVal)
-
-
-
Field Detail
-
PER_THREAD_LOG_FILTER_KEY
public static final java.lang.String PER_THREAD_LOG_FILTER_KEY
- See Also:
- Constant Field Values
-
PER_THREAD_LOG_FILTER
static final boolean PER_THREAD_LOG_FILTER
-
configured
private final java.util.concurrent.atomic.AtomicBoolean configured
-
-
Method Detail
-
tryGetProperty
private static java.lang.String tryGetProperty(java.lang.String name, java.lang.String defaultVal)
-
readConfiguration
public void readConfiguration() throws java.io.IOException, java.lang.SecurityExceptionConfigure the log manager one time. An implementation ofConfigurationLocatoris created by constructing an instance of the class name specified in theorg.jboss.logmanager.configurationLocatorsystem property.- Overrides:
readConfigurationin classjava.util.logging.LogManager- Throws:
java.io.IOExceptionjava.lang.SecurityException
-
readConfiguration
public void readConfiguration(java.io.InputStream inputStream) throws java.io.IOException, java.lang.SecurityExceptionConfigure the log manager.- Overrides:
readConfigurationin classjava.util.logging.LogManager- Parameters:
inputStream- the input stream from which the logmanager should be configured- Throws:
java.io.IOExceptionjava.lang.SecurityException
-
construct
static <T> T construct(java.lang.Class<? extends T> type, java.lang.String className) throws java.io.IOException- Throws:
java.io.IOException
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener l)
Do nothing. Properties and their listeners are not supported.- Parameters:
l- ignored
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener l)
Do nothing. Properties and their listeners are not supported.- Parameters:
l- ignored
-
getProperty
public java.lang.String getProperty(java.lang.String name)
Does nothing. Properties are not supported.- Overrides:
getPropertyin classjava.util.logging.LogManager- Parameters:
name- ignored- Returns:
null
-
reset
public void reset()
Does nothing. This method only causes trouble.- Overrides:
resetin classjava.util.logging.LogManager
-
getLoggerNames
public java.util.Enumeration<java.lang.String> getLoggerNames()
- Overrides:
getLoggerNamesin classjava.util.logging.LogManager
-
addLogger
public boolean addLogger(java.util.logging.Logger logger)
Do nothing. Loggers are only added/acquired viagetLogger(String).- Overrides:
addLoggerin classjava.util.logging.LogManager- Parameters:
logger- ignored- Returns:
false
-
getLogger
public Logger getLogger(java.lang.String name)
Get or create a logger with the given name.- Overrides:
getLoggerin classjava.util.logging.LogManager- Parameters:
name- the logger name- Returns:
- the corresponding logger
-
getThreadLocalLogFilter
public static java.util.logging.Filter getThreadLocalLogFilter()
Returns the currently set filter for this thread ornullif one has not been set.If the
PER_THREAD_LOG_FILTER_KEYis not set totruethennullwill always be returned.- Returns:
- the filter set for the thread or
nullif no level was set
-
setThreadLocalLogLevel
public static void setThreadLocalLogLevel(java.util.logging.Filter filter)
Sets the filter on the thread for all loggers.This feature only works if the
PER_THREAD_LOG_FILTERwas set totrue- Parameters:
filter- the filter to set for all loggers on this thread
-
-