public class TextFileApplicationLogger extends AbstractApplicationLogger implements Closeable, 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(File file)
Creates a new instance of this class and appends all messaged to the specified file.
|
TextFileApplicationLogger(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(File file, boolean append) throws 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.IOException
public TextFileApplicationLogger(File file) throws IOException
file
- the output fileIOException
public void addMessage(ApplicationLoggerMessage message)
ApplicationLogger
addMessage
in interface ApplicationLogger
public void close()
close
in interface Closeable
close
in interface AutoCloseable