Class Log4JHelper


  • public class Log4JHelper
    extends Object
    Provides helper methods for working with log4j
    Since:
    5.4.2
    Author:
    jcarsique
    • Constructor Detail

      • Log4JHelper

        public Log4JHelper()
    • Method Detail

      • getFileAppendersFileNames

        public static List<String> getFileAppendersFileNames​(org.apache.logging.log4j.core.config.Configuration configuration)
        Returns list of files produced by FileAppenders defined in a given Configuration. There's no need for the log4j configuration corresponding to this repository of being active.
        Parameters:
        configuration - the Configuration to browse looking for FileAppender
        Returns:
        FileAppenders present in configuration
        Since:
        10.3
      • newConfiguration

        public static org.apache.logging.log4j.core.config.Configuration newConfiguration​(File log4jConfigurationFile)
        Creates a Configuration initialized with given log4j configuration file without making this configuration active.
        Parameters:
        log4jConfigurationFile - the XML configuration file to load
        Returns:
        Configuration initialized with log4jConfigurationFile
        Since:
        10.3
      • getFileAppendersFileNames

        public static List<String> getFileAppendersFileNames​(File log4jConfigurationFile)
        Parameters:
        log4jConfigurationFile - the XML configuration file to load
        Returns:
        FileAppenders defined in log4jConfigurationFile
        Since:
        10.3
        See Also:
        getFileAppendersFileNames(Configuration)
      • setLevel

        public static void setLevel​(String[] loggerNames,
                                    org.apache.logging.log4j.Level level,
                                    boolean includeChildren)
        Set DEBUG level on the given logger.
        Parameters:
        loggerNames - the logger names to change level
        level - the level to set
        includeChildren - whether or not to change children levels
        Since:
        10.3