org.apache.juli

## Class AsyncFileHandler

- java.lang.Object
- - java.util.logging.Handler
  - - org.apache.juli.FileHandler
    - - org.apache.juli.AsyncFileHandler

    public class AsyncFileHandler
    extends FileHandler

A `FileHandler` implementation that uses a queue of log entries.

Configuration properties are inherited from the `FileHandler` class. This class does not add its own configuration properties for the logging configuration, but relies on the following system properties instead:

- `org.apache.juli.AsyncOverflowDropType` Default value: `1`
- `org.apache.juli.AsyncMaxRecordCount` Default value: `10000`
- `org.apache.juli.AsyncLoggerPollInterval` Default value: `1000`

See the System Properties page in the configuration reference of Tomcat.

Author:
  Filip Hanik

### Nested Class Summary

Nested Classes
`protected static class` `AsyncFileHandler.LogEntry`
`protected static class` `AsyncFileHandler.LoggerThread`

### Field Summary

Fields
`protected boolean` `closed`
`static int` `DEFAULT_MAX_RECORDS`
`protected static AsyncFileHandler.LoggerThread` `logger`
`static int` `LOGGER_SLEEP_TIME`
`static int` `OVERFLOW_DROP_CURRENT`
`static int` `OVERFLOW_DROP_FIRST`
`static int` `OVERFLOW_DROP_FLUSH`
`static int` `OVERFLOW_DROP_LAST`
`static int` `OVERFLOW_DROP_TYPE`
`protected static LinkedBlockingDeque<AsyncFileHandler.LogEntry>` `queue`

### Fields inherited from class org.apache.juli.FileHandler

`writerLock`

### Constructor Summary

Constructors
Constructor and Description
`AsyncFileHandler()`
`AsyncFileHandler(String directory, String prefix, String suffix)`

### Method Summary

Methods
`void` `close()` Close the currently open log file (if any).
`protected void` `open()` Open the new log file for the date specified by `date`.
`void` `publish(LogRecord record)` Format and publish a `LogRecord`.
`protected void` `publishInternal(LogRecord record)`

### Methods inherited from class org.apache.juli.FileHandler

`closeWriter, flush, openWriter`

### Methods inherited from class java.util.logging.Handler

`getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### OVERFLOW_DROP_LAST

    public static final int OVERFLOW_DROP_LAST

See Also:
  Constant Field Values

#### OVERFLOW_DROP_FIRST

    public static final int OVERFLOW_DROP_FIRST

See Also:
  Constant Field Values

#### OVERFLOW_DROP_FLUSH

    public static final int OVERFLOW_DROP_FLUSH

See Also:
  Constant Field Values

#### OVERFLOW_DROP_CURRENT

    public static final int OVERFLOW_DROP_CURRENT

See Also:
  Constant Field Values

#### OVERFLOW_DROP_TYPE

    public static final int OVERFLOW_DROP_TYPE

#### DEFAULT_MAX_RECORDS

    public static final int DEFAULT_MAX_RECORDS

#### LOGGER_SLEEP_TIME

    public static final int LOGGER_SLEEP_TIME

#### queue

    protected static LinkedBlockingDeque<AsyncFileHandler.LogEntry> queue

#### logger

    protected static AsyncFileHandler.LoggerThread logger

#### closed

    protected volatile boolean closed

### Constructor Detail

#### AsyncFileHandler

    public AsyncFileHandler()

#### AsyncFileHandler

    public AsyncFileHandler(String directory,
                    String prefix,
                    String suffix)

### Method Detail

#### close

    public void close()

Description copied from class: `FileHandler`
Close the currently open log file (if any).

Overrides:
  `close` in class `FileHandler`

#### open

    protected void open()

Description copied from class: `FileHandler`
Open the new log file for the date specified by `date`.

Overrides:
  `open` in class `FileHandler`

#### publish

    public void publish(LogRecord record)

Description copied from class: `FileHandler`
Format and publish a `LogRecord`.

Overrides:
  `publish` in class `FileHandler`
Parameters:
  `record` - description of the log event

#### publishInternal

    protected void publishInternal(LogRecord record)