Package org.apache.juli
Class FileHandler
java.lang.Object
java.util.logging.Handler
org.apache.juli.FileHandler
- Direct Known Subclasses:
- AsyncFileHandler
Implementation of Handler that appends log messages to a file named {prefix}{date}{suffix} in a configured
 directory.
 
The following configuration properties are available:
- directory- The directory where to create the log file. If the path is not absolute, it is relative to the current working directory of the application. The Apache Tomcat configuration files usually specify an absolute path for this property,- ${catalina.base}/logsDefault value:- logs
- rotatable- If- true, the log file will be rotated on the first write past midnight and the filename will be- {prefix}{date}{suffix}, where date is yyyy-MM-dd. If- false, the file will not be rotated and the filename will be- {prefix}{suffix}. Default value:- true
- prefix- The leading part of the log file name. Default value:- juli.
- suffix- The trailing part of the log file name. Default value:- .log
- bufferSize- Configures buffering. The value of- 0uses system default buffering (typically an 8K buffer will be used). A value of- <0forces a writer flush upon each log write. A value- >0uses a BufferedOutputStream with the defined value but note that the system default buffering will also be applied. Default value:- -1
- encoding- Character set used by the log file. Default value: empty string, which means to use the system default character set.
- level- The level threshold for this Handler. See the- java.util.logging.Levelclass for the possible levels. Default value:- ALL
- filter- The- java.util.logging.Filterimplementation class name for this Handler. Default value: unset
- formatter- The- java.util.logging.Formatterimplementation class name for this Handler. Default value:- org.apache.juli.OneLineFormatter
- maxDays- The maximum number of days to keep the log files. If the specified value is- <=0then the log files will be kept on the file system forever, otherwise they will be kept the specified maximum days. Default value:- -1.
- 
Nested Class SummaryNested Classes
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intstatic final intprotected final ReadWriteLockLock used to control access to the writer.
- 
Constructor SummaryConstructors
- 
Method SummaryMethods inherited from class java.util.logging.HandlergetEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
- 
Field Details- 
DEFAULT_MAX_DAYSpublic static final int DEFAULT_MAX_DAYS- See Also:
 
- 
DEFAULT_BUFFER_SIZEpublic static final int DEFAULT_BUFFER_SIZE- See Also:
 
- 
writerLockLock used to control access to the writer.
 
- 
- 
Constructor Details- 
FileHandlerpublic FileHandler()
- 
FileHandler
- 
FileHandler
- 
FileHandler
 
- 
- 
Method Details- 
publishFormat and publish aLogRecord.
- 
closepublic void close()Close the currently open log file (if any).
- 
closeWriterprotected void closeWriter()
- 
flushpublic void flush()Flush the writer.
- 
openpublic void open()Open the new log file for the date specified bydate.
- 
openWriterprotected void openWriter()
 
-