Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
lock
Lock for synchronizing output.
|
protected org.apache.log4j.Logger |
logger
Log4J logger.
|
protected boolean |
loggerEnabled
True if logger enabled.
|
Constructor and Description |
---|
BaseLogger(java.lang.String logClassName,
java.lang.String logPath,
java.lang.String logConfigFilePath)
Create a logger.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isDebuggingEnabled()
Returns true if debugging messages are enabled.
|
boolean |
isLoggerEnabled()
Returns true if logger is enabled.
|
void |
log(int level,
java.lang.String str)
Logs a message.
|
void |
log(int level,
java.lang.String str,
java.lang.Throwable t)
Logs a message with a stack trace.
|
void |
logDebug(java.lang.String str)
Logs a message at the DEBUG level.
|
void |
logError(java.lang.String str)
Logs a message at the ERROR level.
|
void |
logError(java.lang.String str,
java.lang.Throwable t)
Logs a error message with a stack trace.
|
void |
logFatal(java.lang.String str)
Logs a message at the FATAL level.
|
void |
logFatal(java.lang.String str,
java.lang.Throwable t)
Logs a fatal message with a stack trace.
|
void |
logInfo(java.lang.String str)
Logs a message at the INFO level.
|
void |
logWarning(java.lang.String str)
Logs a message at the WARN level.
|
protected static org.apache.log4j.Priority |
mapLevel(int level)
Maps a LoggerConstants level to log4j level.
|
void |
terminate()
Terminates the logger.
|
protected org.apache.log4j.Logger logger
protected boolean loggerEnabled
protected java.lang.Object lock
public BaseLogger(java.lang.String logClassName, java.lang.String logPath, java.lang.String logConfigFilePath) throws java.io.FileNotFoundException, java.io.IOException
logClassName
- The log class name.logPath
- The path in which to store log files.logConfigFilePath
- Path to log configuration file.
Reads the configuration file, creates a Log4J logger for the specified class name, and configures the logger.
java.io.FileNotFoundException
java.io.IOException
public void terminate()
protected static org.apache.log4j.Priority mapLevel(int level)
level
- LoggerConstants level.public void logDebug(java.lang.String str)
public void logInfo(java.lang.String str)
public void logWarning(java.lang.String str)
logWarning
in interface Logger
str
- Log message.public void logError(java.lang.String str)
public void logError(java.lang.String str, java.lang.Throwable t)
public void logFatal(java.lang.String str)
public void logFatal(java.lang.String str, java.lang.Throwable t)
public void log(int level, java.lang.String str)
public void log(int level, java.lang.String str, java.lang.Throwable t)
public boolean isDebuggingEnabled()
isDebuggingEnabled
in interface Logger
public boolean isLoggerEnabled()
isLoggerEnabled
in interface Logger