public class TextFileApplicationLogger extends AbstractApplicationLogger implements java.io.Closeable, java.io.Flushable
ApplicationLogger
appends all log messages to a text file, where every
message is written to one line. Note that the close()
method of this logger has to be called
after the end of the logging process.Constructor and Description |
---|
TextFileApplicationLogger(java.io.File file)
Creates a new instance of this class and appends all messaged to the specified file.
|
TextFileApplicationLogger(java.io.File file,
boolean append)
Creates a new instance of this class and writes all messaged to the specified file.
|
Modifier and Type | Method and Description |
---|---|
void |
addMessage(ApplicationLoggerMessage message)
Outputs a usual message to the user.
|
void |
close() |
void |
flush() |
addError, addError, addError, addError, addMessage, addMessage, addWarning, addWarning
public TextFileApplicationLogger(java.io.File file, boolean append) throws java.io.IOException
file
- the output fileappend
- Specify true
here if you want messages to be appended to an existing file
or false
if an existing file shall be overwritten.java.io.IOException
public TextFileApplicationLogger(java.io.File file) throws java.io.IOException
file
- the output filejava.io.IOException
public void addMessage(ApplicationLoggerMessage message)
ApplicationLogger
addMessage
in interface ApplicationLogger
public void close()
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
public void flush()
flush
in interface java.io.Flushable