|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.util.logging.AbstractLogWriter
org.jscience.util.logging.LogFile
public class LogFile
LogFile provides great convenience for logging information from a program into a file. Every call to a write method is flushed immediatey, so the content of a LogFile always accurately corresponds to how far a logging program actually ran; i.e. the logging as a LogWriter is done synchronously. IOExceptions are replaced with LogException, which should make it easier to write the code for the logging program - with the usual drawbacks of ensuring proper Exception handling. For most cases, however, this should make things easier.
LogException,
Logger,
LogEntry,
DBLineLogFormatter| Field Summary |
|---|
| Fields inherited from class org.jscience.util.logging.AbstractLogWriter |
|---|
filter, formatter |
| Constructor Summary | |
|---|---|
LogFile(java.io.File file)
uses a DBLineLogFormatter |
|
LogFile(java.io.File file,
LogEntryFormatter formatter)
constructs a LogFile based on the given file and formatter |
|
LogFile(java.lang.String fileName)
This constructor simply calls LogFile(new File(fileName)) |
|
| Method Summary | |
|---|---|
void |
close()
closes the underlying writer. |
long |
elapsedTime()
returns the elapsed time since LogFile initialization or since the last call to resetTime(). |
protected void |
finalize()
DOCUMENT ME! |
void |
flush()
only needed if getAlwaysFlush() returns false |
boolean |
getAlwaysFlush()
true by default |
java.io.File |
getFile()
DOCUMENT ME! |
LogEntryFormatter |
getLogFormatter()
DOCUMENT ME! |
void |
reInitialize(java.io.File file,
LogEntryFormatter formatter)
This method initializes the LogFile to a new file. |
void |
resetTime()
resets the time of the embedded Stopwatch that gets initialized with the constructor |
void |
setAlwaysFlush(boolean flag)
DOCUMENT ME! |
void |
setLogFormatter(LogEntryFormatter formatter)
DOCUMENT ME! |
java.lang.String |
toString()
DOCUMENT ME! |
protected void |
write(java.lang.String text)
This is the only method actually writing to the file; all other 'write' methods call this method |
void |
writeElapsedTime()
writes a LogFile entry with the elapsed time since initialization or since the last call to resetTime(). |
void |
writeln()
DOCUMENT ME! |
void |
writeln(java.lang.Object o)
note that this function doesn't write serialized objects, but it calls toString() on the object and writes the String to the file |
void |
writeln(java.lang.String text)
DOCUMENT ME! |
void |
writeLogEntry(java.lang.Object pattern)
This method writes a one-line version String of the entry into the file. |
| Methods inherited from class org.jscience.util.logging.AbstractLogWriter |
|---|
accept, getLogFilter, setLogFilter, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public LogFile(java.lang.String fileName)
throws java.io.IOException
LogFile(new File(fileName))
fileName - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
public LogFile(java.io.File file)
throws java.io.IOException
file - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
public LogFile(java.io.File file,
LogEntryFormatter formatter)
throws java.io.IOException
file - DOCUMENT ME!formatter - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!| Method Detail |
|---|
public void reInitialize(java.io.File file,
LogEntryFormatter formatter)
throws java.io.IOException
file - DOCUMENT ME!formatter - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!public void resetTime()
Stopwatchpublic long elapsedTime()
public void writeLogEntry(java.lang.Object pattern)
throws LogException
writeLogEntry in class AbstractLogWriterpattern - DOCUMENT ME!
LogException - DOCUMENT ME!DBLineLogFormatterpublic LogEntryFormatter getLogFormatter()
getLogFormatter in class AbstractLogWriterpublic void setLogFormatter(LogEntryFormatter formatter)
setLogFormatter in class AbstractLogWriterformatter - DOCUMENT ME!
public void writeElapsedTime()
throws LogException
LogException - DOCUMENT ME!
public void writeln()
throws java.io.IOException
java.io.IOException - DOCUMENT ME!
public void writeln(java.lang.String text)
throws java.io.IOException
text - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
protected void write(java.lang.String text)
throws java.io.IOException
text - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
public void flush()
throws java.io.IOException
getAlwaysFlush() returns false
java.io.IOException - DOCUMENT ME!public void setAlwaysFlush(boolean flag)
flag - DOCUMENT ME!public boolean getAlwaysFlush()
public void writeln(java.lang.Object o)
throws java.io.IOException
o - DOCUMENT ME!
java.io.IOException - DOCUMENT ME!
public void close()
throws java.io.IOException
java.io.IOException - DOCUMENT ME!public java.io.File getFile()
public java.lang.String toString()
toString in class java.lang.Object
protected void finalize()
throws java.lang.Exception
finalize in class java.lang.Objectjava.lang.Exception - DOCUMENT ME!
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||