|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.oreodata.util.Logger
A class that manages logging. Everything is setup and works through static methods.
Nothing needs to be done to use the logging system. In that case, errors are logged to stderr. By default, all log messages are logged.
A log file can be specified (setLogFileName()
) and
a log level can be set (setLogLevel()
) in order
to filter out less important messages. Log levels, in increasing
order of severity are: LOG_DEBUG, LOG_INFO, LOG_WARN, and
LOG_ERROR
. LOG_ERROR
cannot be filtered out.
The logging system can be setup from anywhere in a program, but
it usually done from within init()
or main()
.
In the end an implementor of Log is actually used to perform the logging. Any implementor of Log can be used.
I don't like this logging class much. It has no notion of the Servlet or ServletContext from which you are logging.(JR)
Field Summary | |
static java.lang.String |
LINE_SEPARATOR
|
static int |
LOG_ALL
|
static int |
LOG_DEBUG
|
static int |
LOG_ERROR
|
static int |
LOG_INFO
|
static int |
LOG_WARN
|
Constructor Summary | |
Logger()
|
Method Summary | |
static void |
log(java.lang.String msg)
Log the message. |
static void |
log(java.lang.String msg,
int level)
Log the message at the specified level. |
static void |
logException(java.lang.Throwable t)
|
static void |
logException(java.lang.Throwable t,
int level)
log an exception, including the stack trace. |
static void |
setLogFileName(java.lang.String newFile)
Set the log file name. |
static void |
setLogFileName(java.lang.String filename,
boolean echoToCons)
Set the log file name. |
static void |
setLogLevel(int newLevel)
Set the log level. |
static void |
setServletContext(javax.servlet.ServletContext servletContext)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int LOG_ALL
public static final int LOG_DEBUG
public static final int LOG_INFO
public static final int LOG_WARN
public static final int LOG_ERROR
public static final java.lang.String LINE_SEPARATOR
Constructor Detail |
public Logger()
Method Detail |
public static void setLogFileName(java.lang.String newFile)
newFile
- the name of the log file to be used, which can be
changed at any time.
Note that, by default, log messages will also to stderr.public static void setServletContext(javax.servlet.ServletContext servletContext)
public static void setLogFileName(java.lang.String filename, boolean echoToCons)
echoToCons
- indicates whether to echo log messages to stderr
as well.public static void setLogLevel(int newLevel)
newLevel
- the lowest level for which messages should be logged.
(newLevel == LOG_ALL) ||
(newLevel == LOG_DEBUG) || (newLevel == LOG_INFO) ||
(newLevel == LOG_WARN) || (newLevel == LOG_ERROR)
public static void log(java.lang.String msg)
msg
- the message to log.public static void log(java.lang.String msg, int level)
msg
- the message to log.level
- the level at which to log the message.
should be one of:
public static void logException(java.lang.Throwable t, int level)
public static void logException(java.lang.Throwable t)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |