java.io.Closeable
, java.io.Flushable
, java.lang.AutoCloseable
, FlushableCloseable
, Protectable
PeriodicRotatingFileHandler
, SizeRotatingFileHandler
public class FileHandler extends OutputStreamHandler
handlers, handlersUpdater
outputLock
Constructor | Description |
---|---|
FileHandler() |
Construct a new instance with no formatter and no output file.
|
FileHandler(java.io.File file) |
Construct a new instance with the given output file.
|
FileHandler(java.io.File file,
boolean append) |
Construct a new instance with the given output file and append setting.
|
FileHandler(java.lang.String fileName) |
Construct a new instance with the given output file.
|
FileHandler(java.lang.String fileName,
boolean append) |
Construct a new instance with the given output file and append setting.
|
FileHandler(java.util.logging.Formatter formatter) |
Construct a new instance with the given formatter and no output file.
|
FileHandler(java.util.logging.Formatter formatter,
java.io.File file) |
Construct a new instance with the given formatter and output file.
|
FileHandler(java.util.logging.Formatter formatter,
java.io.File file,
boolean append) |
Construct a new instance with the given formatter, output file, and append setting.
|
Modifier and Type | Method | Description |
---|---|---|
java.io.File |
getFile() |
Get the current output file.
|
void |
setAppend(boolean append) |
Specify whether to append to the target file.
|
void |
setFile(java.io.File file) |
Set the output file.
|
void |
setFileName(java.lang.String fileName) |
Set the output file by name.
|
addHandler, checkAccess, checkAccess, clearHandlers, disableAccess, enableAccess, getHandlers, isAutoFlush, isCallerCalculationRequired, isCloseChildren, isEnabled, protect, publish, publish, removeHandler, setAutoFlush, setCloseChildren, setEnabled, setErrorManager, setFilter, setFormatter, setHandlers, setLevel, unprotect
getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getEncoding, setEncoding, setOutputStream, setWriter
public FileHandler()
public FileHandler(java.util.logging.Formatter formatter)
formatter
- the formatterpublic FileHandler(java.util.logging.Formatter formatter, java.io.File file) throws java.io.FileNotFoundException
formatter
- the formatterfile
- the filejava.io.FileNotFoundException
- if the file could not be found on openpublic FileHandler(java.util.logging.Formatter formatter, java.io.File file, boolean append) throws java.io.FileNotFoundException
formatter
- the formatterfile
- the fileappend
- true
to append, false
to overwritejava.io.FileNotFoundException
- if the file could not be found on openpublic FileHandler(java.io.File file) throws java.io.FileNotFoundException
file
- the filejava.io.FileNotFoundException
- if the file could not be found on openpublic FileHandler(java.io.File file, boolean append) throws java.io.FileNotFoundException
file
- the fileappend
- true
to append, false
to overwritejava.io.FileNotFoundException
- if the file could not be found on openpublic FileHandler(java.lang.String fileName) throws java.io.FileNotFoundException
fileName
- the file namejava.io.FileNotFoundException
- if the file could not be found on openpublic FileHandler(java.lang.String fileName, boolean append) throws java.io.FileNotFoundException
fileName
- the file nameappend
- true
to append, false
to overwritejava.io.FileNotFoundException
- if the file could not be found on openpublic void setAppend(boolean append)
append
- true
to append, false
to overwritepublic void setFile(java.io.File file) throws java.io.FileNotFoundException
file
- the filejava.io.FileNotFoundException
- if an error occurs opening the filepublic java.io.File getFile()
public void setFileName(java.lang.String fileName) throws java.io.FileNotFoundException
fileName
- the file namejava.io.FileNotFoundException
- if an error occurs opening the fileCopyright © 2018. All rights reserved.