public class Log4j extends LogManager
Modifier and Type | Field and Description |
---|---|
private static String |
LOG4J_CONF_PROPERTY
The property that specifies the path to the log4j properties file.
|
private org.apache.log4j.Logger |
mLogger
The handle to a log4j logger object.
|
private Properties |
mProperties
The properties passed at runtime
|
private static org.apache.log4j.Logger |
mRoot
Keeps track of log4j's root logger as singleton.
|
CONFIG_MESSAGE_LEVEL, CONSOLE_MESSAGE_LEVEL, DEBUG_MESSAGE_LEVEL, DEFAULT_LOGGER, ERROR_MESSAGE_LEVEL, FATAL_MESSAGE_LEVEL, INFO_MESSAGE_LEVEL, LOG4J_LOGGER, mDebugLevel, MESSAGE_DONE_PREFIX, mLogFormatter, PROPERTIES_PREFIX, TRACE_MESSAGE_LEVEL, VERSION, WARNING_MESSAGE_LEVEL
Constructor and Description |
---|
Log4j()
The constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getLevel()
Returns the debug level.
|
void |
initialize(LogFormatter formatter,
Properties properties)
Sets the log formatter to use for formatting the messages.
|
void |
log(String message,
Exception e,
int level)
Logs the exception on the appropriate queue if the level of the message
is less than or equal to the level set for the Logger.
|
protected void |
logAlreadyFormattedMessage(String message,
int level)
Logs the message on the appropriate queue if the level of the message
is less than or equal to the level set for the Logger.
|
void |
logEntityHierarchyMessage(String parentType,
String parentID,
String childIDType,
Collection<String> childIDs)
Log a message that connects the parent entities with the
children.
|
void |
logEventCompletion(int level)
Logs the completion message on the basis of the debug level.
|
void |
setLevel(int level)
Sets the debug level.
|
protected void |
setLevel(int level,
boolean info)
Sets the debug level.
|
void |
setLevel(org.apache.log4j.Level level)
Sets the debug level.
|
protected void |
setLevel(org.apache.log4j.Level level,
boolean info)
Sets the debug level.
|
void |
setWriters(String out)
Sets both the output writer and the error writer to the same
underlying writer.
|
add, add, getInstance, log, log, logAndReset, logEntityHierarchyMessage, logEventCompletion, logEventStart, logEventStart, logEventStart, logEventStart, sanityCheckOnDirectory, sanityCheckOnFile
private static final String LOG4J_CONF_PROPERTY
private org.apache.log4j.Logger mLogger
private static org.apache.log4j.Logger mRoot
private Properties mProperties
public void initialize(LogFormatter formatter, Properties properties)
initialize
in class LogManager
formatter
- the formatter to use.properties
- properties that the underlying implementations understandpublic void logEntityHierarchyMessage(String parentType, String parentID, String childIDType, Collection<String> childIDs)
logEntityHierarchyMessage
in class LogManager
parentType
- the type of parent entityparentID
- the id of the parent entitychildIDType
- the type of children entitieschildIDs
- Collection of children id'spublic void setLevel(org.apache.log4j.Level level)
setLevel
in class LogManager
level
- the level to which the debug level needs to be set to.public void setLevel(int level)
setLevel
in class LogManager
level
- the level to which the debug level needs to be set to.protected void setLevel(int level, boolean info)
setLevel
in class LogManager
level
- the level to which the debug level needs to be set to.info
- boolean denoting whether the INFO messages need to be
logged or not.protected void setLevel(org.apache.log4j.Level level, boolean info)
level
- the level to which the debug level needs to be set to.info
- boolean denoting whether the INFO messages need to be
logged or not.public int getLevel()
getLevel
in class LogManager
public void setWriters(String out)
setWriters
in class LogManager
out
- is the name of a file to append to. Special names are
stdout
and stderr
, which map to the
system's respective streams.public void log(String message, Exception e, int level)
log
in class LogManager
message
- the message to be logged.e
- the exception to be loggedlevel
- the level on which the message has to be logged.setLevel(int)
,
LogManager.log(String,int)
protected void logAlreadyFormattedMessage(String message, int level)
logAlreadyFormattedMessage
in class LogManager
message
- the message to be logged.level
- the level on which the message has to be logged.setLevel(int)
public void logEventCompletion(int level)
logEventCompletion
in class LogManager
level
- the debug level of the start message for whose completion
you want.Copyright © 2011 The University of Southern California. All Rights Reserved.