|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.foxsmart.ic.util.Logger
public class Logger
This class handles logging of trace messages to various locations. By default, logging goes to Standard Out and System.out and System.err are left alone.
| Field Summary | |
|---|---|
static java.lang.String |
DEBUG
|
static java.lang.String |
DEBUG_DETAIL
|
static java.lang.String |
INFO
|
static java.lang.String |
NONE
|
| Constructor Summary | |
|---|---|
Logger()
|
|
| Method Summary | |
|---|---|
static void |
clearPausedMessages()
Clears any paused messages in the internal buffer. |
static java.lang.String |
getLogLevel()
Gets the current logging level. |
static java.io.PrintStream |
getNormalStandardError()
Gets the normal Standard Error location. |
static java.io.PrintStream |
getNormalStandardOut()
Gets the normal Standard Out location. |
static java.io.ByteArrayOutputStream |
getPausedMessages()
Gets all messages that are being stored internally while logging is paused. |
static boolean |
isLoggingOutputPaused()
Returns whether logging output is paused or not. |
static void |
log(java.lang.Object object)
Logs a message as an INFO level message with no timestamp. |
static void |
log(java.lang.Object object,
java.lang.String logLevel)
Logs a message in the specified log level with no timestamp. |
static void |
log(java.lang.Object object,
java.lang.String logLevel,
boolean includeTimestamp)
Logs a message in the specified log level with a timestamp specifier. |
static void |
logToFile(java.lang.String filename)
Sets logging to go to a file. |
static void |
logToFile(java.lang.String filename,
boolean append)
Sets logging to go to a file. |
static void |
logToNormalStdOutAndErr()
Sets logging to go to the original Standard Out and Standard Error locations. |
static void |
main(java.lang.String[] args)
Test Driver. |
static void |
pauseLoggingOutput()
Pauses logging. |
static void |
resumeLoggingOutput()
Resumes logging. |
static void |
setLogLevel(java.lang.String logLevel)
Sets the logging level. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String NONE
public static final java.lang.String INFO
public static final java.lang.String DEBUG
public static final java.lang.String DEBUG_DETAIL
| Constructor Detail |
|---|
public Logger()
| Method Detail |
|---|
public static void setLogLevel(java.lang.String logLevel)
throws java.lang.Exception
logLevel - The log level to set.
java.lang.Exception - if the log level is invalid.public static java.lang.String getLogLevel()
public static java.io.PrintStream getNormalStandardOut()
public static java.io.PrintStream getNormalStandardError()
public static void logToNormalStdOutAndErr()
public static void logToFile(java.lang.String filename)
throws java.io.IOException
filename - The filename to log messages to.
java.io.IOException - if the file could not be written to.
public static void logToFile(java.lang.String filename,
boolean append)
throws java.io.IOException
filename - The filename to log messages to.append - If true, log messages will be appended to the end of the file if it currently exists. If false, the
file will be overwritten if it exists.
java.io.IOException - if the file could not be written to.public static boolean isLoggingOutputPaused()
public static void pauseLoggingOutput()
public static void clearPausedMessages()
public static java.io.ByteArrayOutputStream getPausedMessages()
public static void resumeLoggingOutput()
public static void log(java.lang.Object object)
object - The object whose toString method will be logged.
public static void log(java.lang.Object object,
java.lang.String logLevel)
object - The object whose toString method will be logged.logLevel - The log level for the message.
public static void log(java.lang.Object object,
java.lang.String logLevel,
boolean includeTimestamp)
object - The object whose toString method will be logged. If null is passed in, no message will be logged.logLevel - The log level for the message. If the log level is not recognized, the default INFO level will be
used.includeTimestamp - If true, the message will be logged with a timestamp. If false, no timestamp will be
logged.public static void main(java.lang.String[] args)
args - program arguments.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||