public class Log4JHelper extends Object
Modifier and Type | Field and Description |
---|---|
static String |
CONSOLE_APPENDER_NAME |
protected static String |
FULL_PATTERN_LAYOUT |
protected static String |
LIGHT_PATTERN_LAYOUT |
Constructor and Description |
---|
Log4JHelper() |
Modifier and Type | Method and Description |
---|---|
static ArrayList<String> |
getFileAppendersFiles(File log4jConfigurationFile) |
static ArrayList<String> |
getFileAppendersFiles(org.apache.log4j.spi.LoggerRepository loggerRepository)
Returns list of files produced by
FileAppender s defined in a given LoggerRepository . |
static org.apache.log4j.spi.LoggerRepository |
getNewLoggerRepository(File log4jConfigurationFile)
Creates a
LoggerRepository initialized with given log4j configuration file without making this
configuration active. |
static void |
setDebug(String[] categories,
boolean debug,
boolean includeChildren,
String[] appenderNames) |
static void |
setDebug(String category,
boolean debug)
Set DEBUG level on the given category and change pattern layout of
CONSOLE_APPENDER_NAME if defined. |
static void |
setDebug(String categories,
boolean debug,
boolean includeChildren,
String[] appenderNames)
Set DEBUG level on the given category and the children categories.
|
static void |
setQuiet(String appenderName)
Set "quiet" mode: set log level to WARN for the given Log4J appender.
|
public static final String CONSOLE_APPENDER_NAME
protected static final String FULL_PATTERN_LAYOUT
protected static final String LIGHT_PATTERN_LAYOUT
public Log4JHelper()
public static ArrayList<String> getFileAppendersFiles(org.apache.log4j.spi.LoggerRepository loggerRepository)
FileAppender
s defined in a given LoggerRepository
. There's no
need for the log4j configuration corresponding to this repository of being active.loggerRepository
- LoggerRepository
to browse looking for FileAppender
FileAppender
s configured in loggerRepositorypublic static org.apache.log4j.spi.LoggerRepository getNewLoggerRepository(File log4jConfigurationFile)
LoggerRepository
initialized with given log4j configuration file without making this
configuration active.log4jConfigurationFile
- XML Log4J configuration file to load.LoggerRepository
initialized with log4jConfigurationFilepublic static ArrayList<String> getFileAppendersFiles(File log4jConfigurationFile)
log4jConfigurationFile
- FileAppender
s defined in log4jConfigurationFilegetFileAppendersFiles(LoggerRepository)
public static void setDebug(String categories, boolean debug, boolean includeChildren, String[] appenderNames)
categories
- Log4J categories for which to switch debug log level (comma separated values)debug
- set debug log level to true or falseincludeChildren
- Also set/unset debug mode on children categoriesappenderNames
- Appender names on which to set a detailed pattern layout. Ignored if null.public static void setDebug(String[] categories, boolean debug, boolean includeChildren, String[] appenderNames)
categories
- debug
- includeChildren
- appenderNames
- public static void setDebug(String category, boolean debug)
CONSOLE_APPENDER_NAME
if defined.
Children categories are unchanged.category
- Log4J category for which to switch debug log leveldebug
- set debug log level to true or falsesetDebug(String, boolean, boolean, String[])
Copyright © 2016 Nuxeo SA. All rights reserved.