|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sourceforge.jsxe.util.Log
This class provides methods for logging events. In terms of functionality,
it is somewhere in between System.out.println() and
full-blown logging packages such as log4j.
All events are logged to a Swing text document and optionally a stream, and those with a high urgency (warnings and errors) are also printed to standard output.
This class can also optionally redirect standard output and error to the log.
| Field Summary | |
static int |
DEBUG
Debugging message urgency. |
static int |
ERROR
Error urgency. |
static int |
MAXLINES
The maximum number of log messages that will be kept in memory. |
static int |
MESSAGE
Message urgency. |
static int |
NOTICE
Notice urgency. |
static int |
WARNING
Warning urgency. |
| Method Summary | |
static void |
closeStream()
Closes the log stream. |
static void |
flushStream()
Flushes the log stream. |
static Document |
getLogDocument()
Returns the document where the most recent messages are stored. |
static void |
init(boolean stdio,
int level,
boolean debug)
Initializes the log. |
static void |
log(int urgency,
Object source,
Object message)
Logs a message. |
static void |
setDebug(boolean debug)
Sets whether debug is recorded to the log. |
static void |
setLogWriter(Writer stream)
Writes all currently logged messages to this stream if there was no stream set previously, and sets the stream to write future log messages to. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int MAXLINES
public static final int DEBUG
public static final int MESSAGE
public static final int NOTICE
public static final int WARNING
public static final int ERROR
| Method Detail |
public static void init(boolean stdio,
int level,
boolean debug)
stdio - If true, standard output and error will be
sent to the loglevel - Messages with this log level or higher will
be printed to the system consoledebug - If true, debug will be printed to the log even if it is not
at or higher than the level (second arg)public static void setLogWriter(Writer stream)
stream - The writerpublic static Document getLogDocument()
public static void flushStream()
public static void closeStream()
public static void log(int urgency,
Object source,
Object message)
The following code sends a typical debugging message to the activity log:
Log.log(Log.DEBUG,this,"counter = " + counter);The corresponding activity log entry might read as follows:
[debug] JavaParser: counter = 15
urgency - The urgency; can be one of
DEBUG, MESSAGE, NOTICE,
WARNING, or ERROR.source - The source of the message, either an object or a
class instance. When writing log messages from macros, set
this parameter to BeanShell.class to make macro
errors easier to spot in the activity log.message - The message. This can either be a string or
an exceptionpublic static void setDebug(boolean debug)
debug - If true, debug will be printed to the log even if it is not
at or higher than the level.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||