Class LogManager


  • public final class LogManager
    extends java.util.logging.LogManager
    Simplified log manager. Designed to work around the (many) design flaws of the JDK platform log manager.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String PER_THREAD_LOG_FILTER_KEY  
      • Fields inherited from class java.util.logging.LogManager

        LOGGING_MXBEAN_NAME
    • 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
      java.util.logging.LogManager addConfigurationListener​(java.lang.Runnable listener)
      Configuration listeners are not currently supported.
      boolean addLogger​(java.util.logging.Logger logger)
      Do nothing.
      void addPropertyChangeListener​(java.beans.PropertyChangeListener l)
      Do nothing.
      Logger getLogger​(java.lang.String name)
      Get or create a logger with the given name.
      java.util.Enumeration<java.lang.String> getLoggerNames()  
      java.lang.String getProperty​(java.lang.String name)
      Does nothing.
      static java.util.logging.Filter getThreadLocalLogFilter()
      Returns the currently set filter for this thread or null if one has not been set.
      void readConfiguration()
      Configure the log manager one time.
      void readConfiguration​(java.io.InputStream inputStream)
      Configure the log manager.
      void removeConfigurationListener​(java.lang.Runnable listener)
      Configuration listeners are not currently supported.
      void removePropertyChangeListener​(java.beans.PropertyChangeListener l)
      Do nothing.
      void reset()
      Does nothing.
      static void setThreadLocalLogLevel​(java.util.logging.Filter filter)
      Sets the filter on the thread for all loggers.
      void updateConfiguration​(java.io.InputStream ins, java.util.function.Function<java.lang.String,​java.util.function.BiFunction<java.lang.String,​java.lang.String,​java.lang.String>> mapper)
      Does nothing.
      void updateConfiguration​(java.util.function.Function<java.lang.String,​java.util.function.BiFunction<java.lang.String,​java.lang.String,​java.lang.String>> mapper)
      Does nothing.
      • Methods inherited from class java.util.logging.LogManager

        checkAccess, getLoggingMXBean, getLogManager
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • PER_THREAD_LOG_FILTER_KEY

        public static final java.lang.String PER_THREAD_LOG_FILTER_KEY
        See Also:
        Constant Field Values
    • Constructor Detail

      • LogManager

        public LogManager()
        Construct a new logmanager instance. Attempts to plug a known memory leak in Level as well.
    • Method Detail

      • readConfiguration

        public void readConfiguration()
                               throws java.io.IOException,
                                      java.lang.SecurityException
        Configure the log manager one time. An implementation of ConfigurationLocator is created by constructing an instance of the class name specified in the org.jboss.logmanager.configurationLocator system property.
        Overrides:
        readConfiguration in class java.util.logging.LogManager
        Throws:
        java.io.IOException
        java.lang.SecurityException
      • readConfiguration

        public void readConfiguration​(java.io.InputStream inputStream)
                               throws java.io.IOException,
                                      java.lang.SecurityException
        Configure the log manager.
        Overrides:
        readConfiguration in class java.util.logging.LogManager
        Parameters:
        inputStream - the input stream from which the logmanager should be configured
        Throws:
        java.io.IOException
        java.lang.SecurityException
      • 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
      • updateConfiguration

        public void updateConfiguration​(java.util.function.Function<java.lang.String,​java.util.function.BiFunction<java.lang.String,​java.lang.String,​java.lang.String>> mapper)
                                 throws java.io.IOException
        Does nothing. The configuration API should be used.
        Overrides:
        updateConfiguration in class java.util.logging.LogManager
        Parameters:
        mapper - not used
        Throws:
        java.io.IOException
      • updateConfiguration

        public void updateConfiguration​(java.io.InputStream ins,
                                        java.util.function.Function<java.lang.String,​java.util.function.BiFunction<java.lang.String,​java.lang.String,​java.lang.String>> mapper)
                                 throws java.io.IOException
        Does nothing. The configuration API should be used.
        Overrides:
        updateConfiguration in class java.util.logging.LogManager
        Parameters:
        ins - not used
        mapper - not used
        Throws:
        java.io.IOException
      • addConfigurationListener

        public java.util.logging.LogManager addConfigurationListener​(java.lang.Runnable listener)
        Configuration listeners are not currently supported.
        Overrides:
        addConfigurationListener in class java.util.logging.LogManager
        Parameters:
        listener - not used
        Returns:
        this log manager
      • removeConfigurationListener

        public void removeConfigurationListener​(java.lang.Runnable listener)
        Configuration listeners are not currently supported.
        Overrides:
        removeConfigurationListener in class java.util.logging.LogManager
        Parameters:
        listener - not used
      • getProperty

        public java.lang.String getProperty​(java.lang.String name)
        Does nothing. Properties are not supported.
        Overrides:
        getProperty in class java.util.logging.LogManager
        Parameters:
        name - ignored
        Returns:
        null
      • reset

        public void reset()
        Does nothing. This method only causes trouble.
        Overrides:
        reset in class java.util.logging.LogManager
      • getLoggerNames

        public java.util.Enumeration<java.lang.String> getLoggerNames()
        Overrides:
        getLoggerNames in class java.util.logging.LogManager
      • addLogger

        public boolean addLogger​(java.util.logging.Logger logger)
        Do nothing. Loggers are only added/acquired via getLogger(String).
        Overrides:
        addLogger in class java.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:
        getLogger in class java.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 or null if one has not been set.

        If the PER_THREAD_LOG_FILTER_KEY is not set to true then null will always be returned.

        Returns:
        the filter set for the thread or null if 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_FILTER was set to true

        Parameters:
        filter - the filter to set for all loggers on this thread