Package org.jboss.logmanager.handlers
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 org.jboss.logmanager.handlers.WriterHandler
outputLock
Fields inherited from class org.jboss.logmanager.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 org.jboss.logmanager.handlers.OutputStreamHandler
getEncoding, setEncoding, setOutputStream, setWriter
Methods inherited from class org.jboss.logmanager.handlers.WriterHandler
close, doPublish, flush, preWrite, safeClose
Methods inherited from class org.jboss.logmanager.ExtHandler
addHandler, checkAccess, checkAccess, clearHandlers, disableAccess, enableAccess, getHandlers, isAutoFlush, isEnabled, protect, publish, publish, removeHandler, setAutoFlush, setEnabled, setErrorManager, setFilter, setFormatter, setHandlers, setLevel, unprotect
Methods inherited from class java.util.logging.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
-true
to append,false
to 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
-true
to append,false
to 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
-true
to append,false
to 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
-true
to append,false
to overwrite
-
setFile
Set the output file.- Parameters:
file
- the file- Throws:
FileNotFoundException
- if an error occurs opening the file
-
getFile
Get the current output file.- Returns:
- the file
-
setFileName
Set the output file by name.- Parameters:
fileName
- the file name- Throws:
FileNotFoundException
- if an error occurs opening the file
-