|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.adventnet.afp.log.AbstractLogger | +--com.adventnet.afp.log.LoggerImpl
This class is the default implementation of the Logger interface. The display name is given as custom property. The key name for the display name is DisplayName. The user can give his own property as a custom property (similar to DisplayName)in the Logger properties.
Logger
Fields inherited from class com.adventnet.afp.log.AbstractLogger |
listeners, loggingLevel |
Constructor Summary | |
LoggerImpl()
Creates a new LoggerImpl instance with the default Logger properties. |
Method Summary | |
void |
err(java.lang.String message,
int level)
The err method can be used for logging the error messages. |
void |
err(java.lang.String message,
java.lang.Throwable exception,
int level)
The err method can be used for logging the error messages
with the exception trace. |
java.lang.String |
formatMessage(java.lang.String message,
int level)
formatMessage method formats the message to a custom format. |
java.lang.String |
getDisplayName()
To get the display name of the Logger. |
LogWriter |
getLogWriter()
The getLogWriter method is used to get the LogWriter of the Logger. |
void |
init(LoggerProperties loggerProps,
LogWriter logWriter)
The init method is used to intialize the logger. |
void |
out(java.lang.String message,
int level)
The out method can be used for Logging general output
messages and debugging messages. |
void |
setDisplayName(java.lang.String dispName)
To set the display name of the Logger. |
void |
setLogWriter(LogWriter logWriter)
The setLogWriter method is used to assign a LogWriter to the Logger. |
Methods inherited from class com.adventnet.afp.log.AbstractLogger |
addPropertyChangeListener, getInstanceName, getLogLevel, removePropertyChangeListener, setLogLevel |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public LoggerImpl()
LoggerImpl
instance with the default Logger properties.Method Detail |
public void init(LoggerProperties loggerProps, LogWriter logWriter) throws LogException
init
method is used to intialize the logger. A logger is active
and can handle inputs only after it is initialized.init
in class AbstractLogger
loggerProps
- specifies properties of the LoggerlogWriter
- a LogWriter
instance to which the Logger has to be associated.LogException
- if an error occurs during initializationpublic void setLogWriter(LogWriter logWriter)
setLogWriter
method is used to assign a LogWriter to the Logger.
By changing the LogWriter at runtime, the output from a Logger can be redirected to
some other file.logWriter
- a LogWriter
instance to which the Logger has to be associatedpublic LogWriter getLogWriter()
getLogWriter
method is used to get the LogWriter of the Logger.LogWriter
valuepublic java.lang.String getDisplayName()
String
valuepublic void setDisplayName(java.lang.String dispName)
dispName
- a String
valuepublic void out(java.lang.String message, int level)
out
method can be used for Logging general output
messages and debugging messages. The message will be formatted using
the formatMessage(java.lang.String, int)
. The defualt formatting
has the time stamp in the format "hh:mm:ss:SSS DisplayName"
The message will be logged only if the
level of the message is less than or equal to that of the Logger's
logging level.message
- String
valuelevel
- an int
valuepublic void err(java.lang.String message, int level)
err
method can be used for logging the error messages. The message will be formatted using
the DefaultLogger.formatMessage(java.lang.String, int)
. The defualt formatting has the time stamp in the format
"hh:mm:ss:SSS DisplayName"
The message will be logged only if the
level of the message is less than or equal to that of the Logger's
logging level.message
- String
value describing the exceptionlevel
- an int
logging valuepublic void err(java.lang.String message, java.lang.Throwable exception, int level)
err
method can be used for logging the error messages
with the exception trace. The message will be formatted using
the formatMessage(java.lang.String, int)
. The defualt formatting
has the time stamp in the format "hh:mm:ss:SSS DisplayName"
The message will be logged only if the
level of the message is less than or equal to that of the Logger's
logging level.message
- String
value describing the exceptionexception
- a Throwable
exceptionlevel
- an int
logging valuepublic java.lang.String formatMessage(java.lang.String message, int level)
formatMessage
method formats the message to a custom format.
In defualt formatting, the message is prepended with a time stamp in the
format "hh:mm:ss:SSS DisplayName". This method can be overridden
to get the message in the user-defined format.message
- a String
valuelevel
- an int
valueString
value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |