public class EventLog extends java.lang.Object implements Log
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 and Description |
|---|
EventLog()
Constructs a default EventLog object.
|
EventLog(java.io.OutputStream stream)
Constructs an EventLog object with the specified OutputStream.
|
EventLog(java.io.PrintWriter out)
Constructs an EventLog object with the specified PrintWriter.
|
EventLog(java.lang.String pathname)
Constructs an EventLog object with the specified file pathname.
|
public EventLog()
public EventLog(java.lang.String pathname)
throws java.io.IOException
pathname - The file pathname.java.io.IOException - If an error occurs while accessing the file.public EventLog(java.io.OutputStream stream)
throws java.io.IOException
stream - The log OutputStream.java.io.IOException - If an error occurs while accessing the stream.public EventLog(java.io.PrintWriter out)
out - The PrintWriter.protected void finalize()
throws java.lang.Throwable
finalize in class java.lang.Objectjava.lang.Throwablepublic void log(java.lang.String msg)
public void log(java.lang.String msg,
java.lang.Throwable exception)