|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--edu.ucsb.adl.bucket99.Log
Appends time-stamped records to a log file or to a Java logger. Each record consists of a single line delimited by a newline character, and has the following internal structure:
Within fields, the exclamation point ('!field|field|...|field
!'), vertical
bar ('|'), percent sign ('%'), and
newline characters only are escaped in the style of
java.net.URLEncoder. The first field of every record
is the time the record was logged in the semantics of
System.currentTimeMillis; the second field is the type
of the record; and the third field is the name of the entity that
logged the record. The remaining fields (if any) are undefined by
this class and may vary from record to record.
This class is multithread-safe.
$Log: Log.java,v $
Revision 1.3 2003/06/13 04:24:20 gjanee
Added support for logging to Java loggers. If the log filename has
the form "j2se-logger:L" records are logged to
Java logger L at logging level INFO.
Revision 1.2 2003/06/12 15:25:12 gjanee
Minor recoding to avoid using a deprecated method.
Revision 1.1 2000/05/03 05:10:19 gjanee
Initial revision
| Method Summary | |
void |
close()
Decrements the reference count. |
void |
log(java.lang.String recordType,
java.lang.String caller,
java.lang.String[] fields)
Appends a record to the log file. |
static edu.ucsb.adl.bucket99.Log |
openLog(java.lang.String filename)
Opens a log file. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static edu.ucsb.adl.bucket99.Log openLog(java.lang.String filename)
throws java.io.IOException
Log already exists for
filename, its reference count is incremented and
it is returned instead. Otherwise, a new Log is
created and filename is opened for append.
filename - The log file's filename; or, if the value is of the form
"j2se-logger:L", the name L of a
Java Logger
to write to (at logging level INFO).
java.io.IOException - If the log file can't be opened.
public void log(java.lang.String recordType,
java.lang.String caller,
java.lang.String[] fields)
throws java.io.IOException
recordType - The type of record.caller - The name of the entity doing the logging.fields - Additional fields to log, or null.
java.io.IOException - If an I/O error occurs.
public void close()
throws java.io.IOException
java.io.IOException - If an error occurs closing the log file.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||