public class FileHandler
extends java.util.logging.Handler
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}/logs Default value: logsrotatable - 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: trueprefix - The leading part of the log file name. Default value: juli.suffix - The trailing part of the log file name. Default value: .logbufferSize - Configures buffering. The value of 0 uses system default buffering
(typically an 8K buffer will be used). A value of <0 forces a writer flush upon each log write. A
value >0 uses a BufferedOutputStream with the defined value but note that the system default
buffering will also be applied. Default value: -1encoding - 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.Level class for
the possible levels. Default value: ALLfilter - The java.util.logging.Filter implementation class name for this Handler.
Default value: unsetformatter - The java.util.logging.Formatter implementation class name for this Handler.
Default value: org.apache.juli.OneLineFormattermaxDays - The maximum number of days to keep the log files. If the specified value is
<=0 then the log files will be kept on the file system forever, otherwise they will be kept the
specified maximum days. Default value: -1.| Modifier and Type | Class and Description |
|---|---|
protected static class |
FileHandler.ThreadFactory |
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE |
static int |
DEFAULT_MAX_DAYS |
protected java.util.concurrent.locks.ReadWriteLock |
writerLock
Lock used to control access to the writer.
|
| Constructor and Description |
|---|
FileHandler() |
FileHandler(java.lang.String directory,
java.lang.String prefix,
java.lang.String suffix) |
FileHandler(java.lang.String directory,
java.lang.String prefix,
java.lang.String suffix,
java.lang.Integer maxDays) |
FileHandler(java.lang.String directory,
java.lang.String prefix,
java.lang.String suffix,
java.lang.Integer maxDays,
java.lang.Boolean rotatable,
java.lang.Integer bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the currently open log file (if any).
|
protected void |
closeWriter() |
void |
flush()
Flush the writer.
|
protected void |
open()
Open the new log file for the date specified by
date. |
protected void |
openWriter() |
void |
publish(java.util.logging.LogRecord record)
Format and publish a
LogRecord. |
public static final int DEFAULT_MAX_DAYS
public static final int DEFAULT_BUFFER_SIZE
protected final java.util.concurrent.locks.ReadWriteLock writerLock
public FileHandler()
public FileHandler(java.lang.String directory,
java.lang.String prefix,
java.lang.String suffix)
public FileHandler(java.lang.String directory,
java.lang.String prefix,
java.lang.String suffix,
java.lang.Integer maxDays)
public FileHandler(java.lang.String directory,
java.lang.String prefix,
java.lang.String suffix,
java.lang.Integer maxDays,
java.lang.Boolean rotatable,
java.lang.Integer bufferSize)
public void publish(java.util.logging.LogRecord record)
LogRecord.publish in class java.util.logging.Handlerrecord - description of the log eventpublic void close()
close in class java.util.logging.Handlerprotected void closeWriter()
public void flush()
flush in class java.util.logging.Handlerprotected void open()
date.protected void openWriter()
Copyright © 2000-2024 Apache Software Foundation.
Apache Tomcat, Tomcat, Apache, the Apache Tomcat logo and the Apache logo are either registered trademarks or trademarks of the Apache Software Foundation.