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:
Flushable,AutoCloseable
- Direct Known Subclasses:
PeriodicRotatingFileHandler,SizeRotatingFileHandler
public class FileHandler extends OutputStreamHandler
A simple file handler.
-
-
Field Summary
-
Fields inherited from class org.jboss.logmanager.ExtHandler
handlers, handlersUpdater, lock
-
-
Constructor Summary
Constructors Constructor Description FileHandler()Construct 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FilegetFile()Get the current output file.voidsetAppend(boolean append)Specify whether to append to the target file.voidsetFile(File file)Set the output file.voidsetFileName(String fileName)Set the output file by name.-
Methods inherited from class org.jboss.logmanager.handlers.OutputStreamHandler
getCharset, setCharsetPrivate, setOutputStream, setWriter
-
Methods inherited from class org.jboss.logmanager.handlers.WriterHandler
close, doPublish, flush, isCheckHeadEncoding, isCheckTailEncoding, preWrite, safeClose, setCheckHeadEncoding, setCheckTailEncoding
-
Methods inherited from class org.jboss.logmanager.ExtHandler
addHandler, checkAccess, checkAccess, clearHandlers, getEncoding, getErrorManager, getFilter, getFormatter, getHandlers, getLevel, isAutoFlush, isCallerCalculationRequired, isCloseChildren, isEnabled, publish, publish, publishToNestedHandlers, removeHandler, reportError, reportError, setAutoFlush, setCharset, setCloseChildren, setEnabled, setEncoding, setErrorManager, setFilter, setFormatter, setHandlers, setLevel
-
Methods inherited from class java.util.logging.Handler
isLoggable
-
-
-
-
Constructor Detail
-
FileHandler
public FileHandler()
Construct a new instance with no formatter and no output file.
-
FileHandler
public FileHandler(Formatter formatter)
Construct a new instance with the given formatter and no output file.- Parameters:
formatter- the formatter
-
FileHandler
public FileHandler(Formatter formatter, File file) throws FileNotFoundException
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
public FileHandler(Formatter formatter, File file, boolean append) throws FileNotFoundException
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
public FileHandler(File file) throws FileNotFoundException
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
public FileHandler(File file, boolean append) throws FileNotFoundException
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
public FileHandler(String fileName) throws FileNotFoundException
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
public FileHandler(String fileName, boolean append) throws FileNotFoundException
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 Detail
-
setAppend
public void setAppend(boolean append)
Specify whether to append to the target file.- Parameters:
append-trueto append,falseto overwrite
-
setFile
public void setFile(File file) throws FileNotFoundException
Set the output file.- Parameters:
file- the file- Throws:
FileNotFoundException- if an error occurs opening the file
-
getFile
public File getFile()
Get the current output file.- Returns:
- the file
-
setFileName
public void setFileName(String fileName) throws FileNotFoundException
Set the output file by name.- Parameters:
fileName- the file name- Throws:
FileNotFoundException- if an error occurs opening the file
-
-