| java.lang.Object org.griphyn.cPlanner.common.LogManager
LogManager | public class LogManager (Code) | | The logging class that to log messages at different levels.
Currently the following levels are supported.
Eventually, each of the level can have a different writer stream underneath.
The messages can be logged at various levels. The various levels of logging
with increasing levels of verbosity are displayed in the following table.
Logging Level | Description |
FATAL |
all fatal error messages are logged in this level. |
ERROR |
all non fatal error messages are logged in this level. |
WARNING |
all warning messages are logged in this level. |
INFO |
all information logging messages are logged in this level. |
CONFIG |
all configuration messages are logged in this level. |
DEBUG |
all debug messages are logged in this level. |
author: Karan Vahi author: Gaurang Mehta version: $Revision: 158 $ |
Method Summary | |
public static LogManager | getInstance() To get a reference to the the object. | public int | getLevel() Returns the debug level. | public String | getTimeStamp() Gets the timestamp nicely formatted. | public 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. | public void | log(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. | public void | logCompletion(String message, int level) Logs the completion message on the basis of the debug level. | public void | setErrorWriter(String out) Certains levels like FATAL, ERROR and WARN can be set to log to a
different stream, than the default stream used for writing other messages.
By default, these messages are logged to stderr.
Note: The previous stream is not closed automatically.
Parameters: out - is the name of a file to append to. | public void | setErrorWriter(OutputStream err) Certains levels like FATAL, ERROR and WARN can be set to log to a
different stream, than the default stream used for writing other messages. | public void | setLevel(Level level) Sets the debug level. | public void | setLevel(int level) Sets the debug level. | public void | setLevel(int level, boolean info) Sets the debug level. | public void | setOutputWriter(String out) Sets the writer associated with the class to the one specified for all
type of messages other than error messages.
Parameters: out - is the name of a file to append to. | public void | setOutputWriter(OutputStream out) Sets the writer associated with the class to the one specified for all
type of messages other than error messages. | public void | setWriters(String out) Sets both the output writer and the error writer to the same
underlying writer.
Parameters: out - is the name of a file to append to. | public void | setWriters(OutputStream err) Sets both the output writer and the error writer to the same
underlying writer. |
CONFIG_MESSAGE_LEVEL | final public static int CONFIG_MESSAGE_LEVEL(Code) | | The level value, to indicate a CONFIG message.
|
DEBUG_MESSAGE_LEVEL | final public static int DEBUG_MESSAGE_LEVEL(Code) | | The level value, to indicate a DEBUG message.
|
ERROR_MESSAGE_LEVEL | final public static int ERROR_MESSAGE_LEVEL(Code) | | The level value, to indicate an ERROR message.
|
FATAL_MESSAGE_LEVEL | final public static int FATAL_MESSAGE_LEVEL(Code) | | The level value, to indicate a FATAL error message.
|
INFO_MESSAGE_LEVEL | final public static int INFO_MESSAGE_LEVEL(Code) | | The level value, to indicate a INFO message.
|
WARNING_MESSAGE_LEVEL | final public static int WARNING_MESSAGE_LEVEL(Code) | | The level value, to indicate a WARNING error message.
|
getInstance | public static LogManager getInstance()(Code) | | To get a reference to the the object.
a singleton access to the object. |
getLevel | public int getLevel()(Code) | | Returns the debug level.
the level to which the debug level has been set to. |
getTimeStamp | public String getTimeStamp()(Code) | | Gets the timestamp nicely formatted. It generates the date-timestamp
in extended ISO 8601 format. It generates the timestamp using
the local timezone not the UTC. An example of the date-timestamp
generated would be 2003-06-06T14:31:27-07:00 where -07:00 denotes the timezone
offset of the local timezone from UTC.
the formattted timestamp; |
log | public void log(String message, Exception e, int level)(Code) | | 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. For INFO level
message, the boolean indicating that a completion message is to follow
is set to true always.
Parameters: message - the message to be logged. Parameters: e - the exception to be logged Parameters: level - the level on which the message has to be logged. See Also: LogManager.setLevel(int) See Also: LogManager.log(String,int) |
log | public void log(String message, int level)(Code) | | 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. For INFO level
message, the boolean indicating that a completion message is to follow
is set to true always.
Parameters: message - the message to be logged. Parameters: level - the level on which the message has to be logged. See Also: LogManager.setLevel(int) See Also: LogManager.log(String,int,boolean) |
logCompletion | public void logCompletion(String message, int level)(Code) | | Logs the completion message on the basis of the debug level.
Parameters: message - the message to be logged. Parameters: level - the debug level of the start message for whose completionyou want. |
setErrorWriter | public void setErrorWriter(String out)(Code) | | Certains levels like FATAL, ERROR and WARN can be set to log to a
different stream, than the default stream used for writing other messages.
By default, these messages are logged to stderr.
Note: The previous stream is not closed automatically.
Parameters: out - is the name of a file to append to. Special names arestdout and stderr , which map to thesystem's respective streams. See Also: LogManager.setErrorWriter(OutputStream) |
setErrorWriter | public void setErrorWriter(OutputStream err)(Code) | | Certains levels like FATAL, ERROR and WARN can be set to log to a
different stream, than the default stream used for writing other messages.
By default, these messages are logged to stderr.
Note: The previous stream is not closed automatically.
Parameters: err - the stream to which error messages are to be logged. |
setLevel | public void setLevel(Level level)(Code) | | Sets the debug level. All those messages are logged which have a
level less than equal to the debug level.
Parameters: level - the level to which the debug level needs to be set to. |
setLevel | public void setLevel(int level)(Code) | | Sets the debug level. All those messages are logged which have a
level less than equal to the debug level. In addition the info messages
are always logged.
Parameters: level - the level to which the debug level needs to be set to. |
setLevel | public void setLevel(int level, boolean info)(Code) | | Sets the debug level. All those messages are logged which have a
level less than equal to the debug level. In case the boolean info
is set, all the info messages are also logged.
Parameters: level - the level to which the debug level needs to be set to. Parameters: info - boolean denoting whether the INFO messages need to belogged or not. |
setOutputWriter | public void setOutputWriter(String out)(Code) | | Sets the writer associated with the class to the one specified for all
type of messages other than error messages.
Parameters: out - is the name of a file to append to. Special names arestdout and stderr , which map to thesystem's respective streams. See Also: LogManager.setOutputWriter(OutputStream) |
setOutputWriter | public void setOutputWriter(OutputStream out)(Code) | | Sets the writer associated with the class to the one specified for all
type of messages other than error messages.
By default it is System.out.
Parameters: out - the stream to which the messages are logged. See Also: LogManager.setErrorWriter(OutputStream) |
setWriters | public void setWriters(String out)(Code) | | Sets both the output writer and the error writer to the same
underlying writer.
Parameters: out - is the name of a file to append to. Special names arestdout and stderr , which map to thesystem's respective streams. See Also: LogManager.setWriters(OutputStream) |
setWriters | public void setWriters(OutputStream err)(Code) | | Sets both the output writer and the error writer to the same
underlying writer.
Note: The previous stream is not closed automatically.
Parameters: err - the stream to which error messages are to be logged. |
|
|