Class FileHandler
java.lang.Object
java.util.logging.Handler
org.jboss.logmanager.ExtHandler
org.jboss.logmanager.handlers.WriterHandler
org.jboss.logmanager.handlers.OutputStreamHandler
org.jboss.logmanager.handlers.FileHandler
- All Implemented Interfaces:
Closeable, Flushable, AutoCloseable, FlushableCloseable, Protectable
- Direct Known Subclasses:
PeriodicRotatingFileHandler, SizeRotatingFileHandler
A simple file handler.
-
Field Summary
FieldsFields inherited from class WriterHandler
outputLockFields inherited from class ExtHandler
handlers, handlersUpdater -
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new instance with no formatter and no output file.FileHandler(File file) Construct a new instance with the given output file.FileHandler(File file, boolean append) Construct a new instance with the given output file and append setting.FileHandler(String fileName) Construct a new instance with the given output file.FileHandler(String fileName, boolean append) Construct a new instance with the given output file and append setting.FileHandler(Formatter formatter) Construct a new instance with the given formatter and no output file.FileHandler(Formatter formatter, File file) Construct a new instance with the given formatter and output file.FileHandler(Formatter formatter, File file, boolean append) Construct a new instance with the given formatter, output file, and append setting. -
Method Summary
Methods inherited from class OutputStreamHandler
getEncoding, setEncoding, setOutputStream, setWriterMethods inherited from class ExtHandler
addHandler, checkAccess, checkAccess, clearHandlers, disableAccess, enableAccess, getHandlers, isAutoFlush, isEnabled, protect, publish, publish, removeHandler, setAutoFlush, setEnabled, setErrorManager, setFilter, setFormatter, setHandlers, setLevel, unprotectMethods inherited from class Handler
getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError
-
Field Details
-
file
-
append
private boolean append
-
-
Constructor Details
-
FileHandler
public FileHandler()Construct a new instance with no formatter and no output file. -
FileHandler
Construct a new instance with the given formatter and no output file.- Parameters:
formatter- the formatter
-
FileHandler
Construct a new instance with the given formatter and output file.- Parameters:
formatter- the formatterfile- the file- Throws:
FileNotFoundException- if the file could not be found on open
-
FileHandler
Construct a new instance with the given formatter, output file, and append setting.- Parameters:
formatter- the formatterfile- the fileappend-trueto append,falseto overwrite- Throws:
FileNotFoundException- if the file could not be found on open
-
FileHandler
Construct a new instance with the given output file.- Parameters:
file- the file- Throws:
FileNotFoundException- if the file could not be found on open
-
FileHandler
Construct a new instance with the given output file and append setting.- Parameters:
file- the fileappend-trueto append,falseto overwrite- Throws:
FileNotFoundException- if the file could not be found on open
-
FileHandler
Construct a new instance with the given output file.- Parameters:
fileName- the file name- Throws:
FileNotFoundException- if the file could not be found on open
-
FileHandler
Construct a new instance with the given output file and append setting.- Parameters:
fileName- the file nameappend-trueto append,falseto overwrite- Throws:
FileNotFoundException- if the file could not be found on open
-
-
Method Details
-
setAppend
public void setAppend(boolean append) Specify whether to append to the target file.- Parameters:
append-trueto append,falseto overwrite
-
setFile
Set the output file.- Parameters:
file- the file- Throws:
FileNotFoundException- if an error occurs opening the file
-
getFile
-
setFileName
Set the output file by name.- Parameters:
fileName- the file name- Throws:
FileNotFoundException- if an error occurs opening the file
-