Class ClassLoaderLogManager

  • public class ClassLoaderLogManager
    extends LogManager
    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.
    • Field Detail


        public static final String DEBUG_PROPERTY
      • 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 final ThreadLocal<String> prefix
        This prefix is used to allow using prefixes for the properties names of handlers and their subcomponents.
      • useShutdownHook

        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

      • ClassLoaderLogManager

        public ClassLoaderLogManager()
    • Method Detail

      • isUseShutdownHook

        public boolean isUseShutdownHook()
      • setUseShutdownHook

        public void setUseShutdownHook​(boolean useShutdownHook)
      • addLogger

        public boolean addLogger​(Logger logger)
        Add the specified logger to the classloader local configuration.
        addLogger in class LogManager
        logger - The logger to be added
      • 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.
        getLogger in class LogManager
        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.
        getLoggerNames in class LogManager
      • getProperty

        public String getProperty​(String name)
        Get the value of the specified property in the classloader local configuration.
        getProperty in class LogManager
        name - The property name
      • shutdown

        public void shutdown()
        Shuts down the logging system.
      • getClassLoaderInfo

        protected 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.
        classLoader - The class loader for which we will retrieve or build the configuration
        the log configuration
      • readConfiguration

        protected void readConfiguration​(ClassLoader classLoader)
                                  throws IOException
        Read configuration for the specified classloader.
        classLoader - The classloader
        IOException - Error reading configuration
      • readConfiguration

        protected void readConfiguration​(InputStream is,
                                         ClassLoader classLoader)
                                  throws IOException
        Load specified configuration.
        is - InputStream to the properties file
        classLoader - for which the configuration will be loaded
        IOException - If something wrong happens during loading
      • doSetParentLogger

        protected static void doSetParentLogger​(Logger logger,
                                                Logger parent)
        Set parent child relationship between the two specified loggers.
        logger - The logger
        parent - The parent logger
      • replace

        protected String replace​(String str)
        System property replacement in the given string.
        str - The original string
        the modified string