A FileHandler is a Handler that writes logging events to one
or more files.
If multiple files are used, when a given amount of data has been written to
one file, this file is closed, and the next file is opened. The names of
these files are generated by the given name pattern, see below for details.
When all the files have all been filled the Handler returns to the first one
and goes through the set again.
FileHandler defines the following configuration properties,
which are read by the LogManager on initialization. If the
properties have not been specified then defaults will be used. The properties
and defaults are as follows:
java.util.logging.FileHandler.append - If true then this
FileHandler appends to a file's existing content, if false it
overwrites it. Default is false.
java.util.logging.FileHandler.count - the number of output files to
rotate. Default is 1.
java.util.logging.FileHandler.filter - the name of the
Filter class. No Filter is used by default.
java.util.logging.FileHandler.formatter - the name of the
Formatter class. Default is
java.util.logging.XMLFormatter.
java.util.logging.FileHandler.encoding - the name of the character set
encoding. Default is the encoding used by the current platform.
java.util.logging.FileHandler.level - the log level for this
Handler. Default is Level.ALL.
java.util.logging.FileHandler.limit - the limit at which no more bytes
should be written to the current file. Default is no limit.
java.util.logging.FileHandler.pattern - the pattern for the name of log
files. Default is "%h/java%u.log".
The name pattern is a String that can contain some of the following
sub-strings, which will be replaced to generate the output file names:
"/" represents the local path separator
"%g" represents the generation number used to enumerate log files
"%h" represents the home directory of the current user, which is
specified by the "user.home" system property
"%t" represents the system's temporary directory
"%u" represents a unique number added to the file name if the original
file required is in use
"%%" represents the percent sign character '%'
The generation numbers, denoted by "%g" in the filename pattern will be
created in ascending numerical order from 0, i.e. 0,1,2,3... If "%g" was not
present in the pattern and more than one file is being used then a dot and a
generation number is appended to the filename at the end. This is equivalent
to appending ".%g" to the pattern.
The unique identifier, denoted by "%u" in the filename pattern will always be
0 unless the FileHandler is unable to open the file. In that
case 1 is tried, then 2, and so on until a file is found that can be opened.
If "%u" was not present in the pattern but a unique number is required then a
dot and a unique number is added to the end of the filename, equivalent to
appending ".%u" to the pattern.
FileHandleris a Handler that writes logging events to one or more files.If multiple files are used, when a given amount of data has been written to one file, this file is closed, and the next file is opened. The names of these files are generated by the given name pattern, see below for details. When all the files have all been filled the Handler returns to the first one and goes through the set again.
FileHandlerdefines the following configuration properties, which are read by theLogManageron initialization. If the properties have not been specified then defaults will be used. The properties and defaults are as follows:FileHandlerappends to a file's existing content, if false it overwrites it. Default is false.Filterclass. NoFilteris used by default.Formatterclass. Default isjava.util.logging.XMLFormatter.Handler. Default isLevel.ALL.The name pattern is a String that can contain some of the following sub-strings, which will be replaced to generate the output file names:
The generation numbers, denoted by "%g" in the filename pattern will be created in ascending numerical order from 0, i.e. 0,1,2,3... If "%g" was not present in the pattern and more than one file is being used then a dot and a generation number is appended to the filename at the end. This is equivalent to appending ".%g" to the pattern.
The unique identifier, denoted by "%u" in the filename pattern will always be 0 unless the
FileHandleris unable to open the file. In that case 1 is tried, then 2, and so on until a file is found that can be opened. If "%u" was not present in the pattern but a unique number is required then a dot and a unique number is added to the end of the filename, equivalent to appending ".%u" to the pattern.