public class FileLogger extends AbstractLogger
Clients may instantiate or subclass this class.
Constructor and Description |
---|
FileLogger(File file)
Constructs a logger which outputs log information into the specified file.
|
FileLogger(File file,
boolean append)
Constructs a logger which outputs log information into the specified file.
|
Modifier and Type | Method and Description |
---|---|
protected void |
log(Level level,
Object message,
Throwable error)
Appends the specified message and error to the underlying file.
|
public FileLogger(File file) throws FileNotFoundException
If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other
reason then a FileNotFoundException
is thrown.
file
- the file where to log information.FileNotFoundException
- if the file exists but is a directory rather than a regular file,
does not exist but cannot be created, or cannot be opened for any other reason.public FileLogger(File file, boolean append) throws FileNotFoundException
If the file exists but is a directory rather than a regular file, does not exist but cannot be created, or cannot be opened for any other
reason then a FileNotFoundException
is thrown.
file
- the file where to log information.append
- if true
, then information will be written to the end of the file rather than the beginning.FileNotFoundException
- if the file exists but is a directory rather than a regular file,
does not exist but cannot be created, or cannot be opened for any other reason.protected void log(Level level, Object message, Throwable error)
log
in class AbstractLogger
level
- the log level (not considered by the implementation).message
- the information to log (usually a String
), maybe null
.error
- an exception to log, maybe null
.