|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.as400.access.EventLog
public class EventLog
The EventLog class is an implementation of Log which logs exceptions and messages to the specified file or PrintStream.
Here is an example use of EventLog, which will write a timestamp and message to the specified file:
EventLog myLog = new EventLog("myFile"); myLog.log("You have successfully written to my log file."); myLog.log("Another log message.");
Each successive message will be appended to the previous messages in the log.
Here is what the log file will look like:
Mon Jan 03 09:00:00 CST 2000 Yout have successfully written to my log file.
Mon Jan 03 09:00:01 CST 2000 Another log message.
Constructor Summary | |
---|---|
EventLog()
Constructs a default EventLog object. |
|
EventLog(OutputStream stream)
Constructs an EventLog object with the specified OutputStream. |
|
EventLog(PrintWriter out)
Constructs an EventLog object with the specified PrintWriter. |
|
EventLog(String pathname)
Constructs an EventLog object with the specified file pathname. |
Method Summary | |
---|---|
protected void |
finalize()
|
void |
log(String msg)
Logs a message to the event log. |
void |
log(String msg,
Throwable exception)
Logs an exception and message to the event log. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public EventLog()
public EventLog(String pathname) throws IOException
pathname
- The file pathname.
IOException
- If an error occurs while accessing the file.public EventLog(OutputStream stream) throws IOException
stream
- The log OutputStream.
IOException
- If an error occurs while accessing the stream.public EventLog(PrintWriter out)
out
- The PrintWriter.Method Detail |
---|
protected void finalize() throws Throwable
finalize
in class Object
Throwable
public void log(String msg)
log
in interface Log
msg
- The message to log.public void log(String msg, Throwable exception)
log
in interface Log
msg
- The message to log.exception
- The exception to log.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |