|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecttuwien.auto.calimero.log.LogWriter
tuwien.auto.calimero.log.LogStreamWriter
tuwien.auto.calimero.log.LogFileWriter
public class LogFileWriter
A LogWriter using a file resource as output destination for log information.
A file name is supplied on creation of this log writer, the file is opened and used for
further logging. After close()ing the log writer, it cannot be opened
anymore.
For output the platform's default character set is used.
A maximum allowed file size may be specified to prevent file size explosion. If the
size limit is reached, the file content is deleted before any new output.
| Field Summary |
|---|
| Fields inherited from class tuwien.auto.calimero.log.LogStreamWriter |
|---|
c, formatOutput |
| Constructor Summary | |
|---|---|
LogFileWriter(LogLevel level,
java.lang.String file,
boolean append)
Like LogFileWriter(String, boolean), with the option to adjust the filter
log level for information logged by LogFileWriter. |
|
LogFileWriter(LogLevel level,
java.lang.String file,
boolean append,
int maxSize)
Like LogFileWriter(LogLevel, String, boolean), with the option to specify
the maximum file size allowed for all output written. |
|
LogFileWriter(LogLevel level,
java.lang.String file,
boolean append,
int maxSize,
boolean autoFlush)
Like LogFileWriter(LogLevel, String, boolean, int), with the option to
adjust the automatic flush behavior of data. |
|
LogFileWriter(java.lang.String file,
boolean append)
Creates a LogFileWriter to write to the output file named by file
and open the file according to append. |
|
LogFileWriter(java.lang.String file,
boolean append,
boolean autoFlush)
Like LogFileWriter(String, boolean), with the option to adjust the
automatic flush behavior of data. |
|
| Method Summary | |
|---|---|
void |
close()
Closes the LogWriter and all its resources. |
java.lang.String |
getFileName()
Returns the file name of the file resource used by this LogFileWriter or "" if the log writer has already been closed. |
int |
getMaxSize()
Returns the maximum allowed file size generated by this LogFileWriter, or 0 if no maximum was set. |
void |
setMaxSize(int size)
Sets the maximum allowed file size generated by this LogFileWriter. |
void |
write(java.lang.String logService,
LogLevel level,
java.lang.String msg)
Writes a message out to this LogWriter. |
void |
write(java.lang.String logService,
LogLevel level,
java.lang.String msg,
java.lang.Throwable t)
Like LogWriter.write(String, LogLevel, String), in addition a
Throwable object is taken which will be added to the message. |
| Methods inherited from class tuwien.auto.calimero.log.LogStreamWriter |
|---|
flush, formatOutput, logAllowed, setOutput |
| Methods inherited from class tuwien.auto.calimero.log.LogWriter |
|---|
getErrorHandler, getLogLevel, setErrorHandler, setLogLevel |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LogFileWriter(LogLevel level,
java.lang.String file,
boolean append)
throws KNXLogException
LogFileWriter(String, boolean), with the option to adjust the filter
log level for information logged by LogFileWriter.
level - log level used by this LogWriter to filter log informationfile - file name in the file system to open or createappend - set this true to append output at end of file, or false to start
writing into an empty file at the beginning
KNXLogException - if file can not be created or opened
public LogFileWriter(LogLevel level,
java.lang.String file,
boolean append,
int maxSize)
throws KNXLogException
LogFileWriter(LogLevel, String, boolean), with the option to specify
the maximum file size allowed for all output written.
During opening of file, the file size is checked to be smaller than
maxSize, otherwise the file content is erased.
If a call to write() would exceed the maximum file size specified, the file content
is erased before the new log information is written.
level - log level used by this LogWriter to filter log informationfile - file name in the file system to open or createappend - set this true to append output at end of file, or false to start
writing into an empty file at the beginningmaxSize - maximum file size generated by this LogFileWriter
KNXLogException - if file can not be created or opened
public LogFileWriter(LogLevel level,
java.lang.String file,
boolean append,
int maxSize,
boolean autoFlush)
throws KNXLogException
LogFileWriter(LogLevel, String, boolean, int), with the option to
adjust the automatic flush behavior of data.
level - log level used by this LogWriter to filter log informationfile - file name in the file system to open or createappend - set this true to append output at end of file, or false to start
writing into an empty file at the beginningmaxSize - maximum file size generated by this LogFileWriterautoFlush - set true to force data be immediately written to file after every
write() call, set false to buffer data and flush only on full buffer
KNXLogException - if file can not be created or opened
public LogFileWriter(java.lang.String file,
boolean append)
throws KNXLogException
file
and open the file according to append.
file - file name in the file system to open or create, the path to the file
has to existappend - set this true to append output at end of file, or false to start
writing into an empty file at the beginning
KNXLogException - if path to file does not exist, if file can not be created
or opened
public LogFileWriter(java.lang.String file,
boolean append,
boolean autoFlush)
throws KNXLogException
LogFileWriter(String, boolean), with the option to adjust the
automatic flush behavior of data.
file - file name in the file system to open or createappend - set this true to append output at end of file, or false to start
writing into an empty file at the beginningautoFlush - set true to force data be immediately written to file after every
write() call, set false to buffer data and flush only on full buffer
KNXLogException - if file can not be created or opened| Method Detail |
|---|
public void close()
LogWriterIf necessary, all output is flushes before.
close in class LogStreamWriterpublic final java.lang.String getFileName()
The file name is the same as supplied on creation of this LogWriter, no path resolving etc. was done.
public final int getMaxSize()
public final void setMaxSize(int size)
The value is only set if size >= 0.
If size has a value of 0, no file size limit is enforced.
size - new allowed file size in bytes
public void write(java.lang.String logService,
LogLevel level,
java.lang.String msg)
LogWriter
The message has the associated log level level. It will only be
written if the LogWriter logging level is not more restrictive than
level. Otherwise the message is ignored. LogWriter is responsible
for formatting the output.
write in class LogStreamWriterlogService - log service name stating the source of the messagelevel - log level of messagemsg - the message to write
public void write(java.lang.String logService,
LogLevel level,
java.lang.String msg,
java.lang.Throwable t)
LogWriterLogWriter.write(String, LogLevel, String), in addition a
Throwable object is taken which will be added to the message.
write in class LogStreamWriterlogService - log service name stating the source of the messagelevel - log level of messagemsg - the message to writet - Throwable object, might be null
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||