/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.juli; import java.util.concurrent.LinkedBlockingDeque; import java.util.concurrent.TimeUnit; import java.util.logging.LogRecord; /** * A {@link FileHandler} implementation that uses a queue of log entries. * *
Configuration properties are inherited from the {@link 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: 1org.apache.juli.AsyncMaxRecordCount
* Default value: 10000org.apache.juli.AsyncLoggerPollInterval
* Default value: 1000See the System Properties page in the configuration reference of Tomcat.
*/ public class AsyncFileHandler extends FileHandler { public static final int OVERFLOW_DROP_LAST = 1; public static final int OVERFLOW_DROP_FIRST = 2; public static final int OVERFLOW_DROP_FLUSH = 3; public static final int OVERFLOW_DROP_CURRENT = 4; public static final int DEFAULT_OVERFLOW_DROP_TYPE = 1; public static final int DEFAULT_MAX_RECORDS = 10000; public static final int DEFAULT_LOGGER_SLEEP_TIME = 1000; public static final int OVERFLOW_DROP_TYPE = Integer.parseInt( System.getProperty("org.apache.juli.AsyncOverflowDropType", Integer.toString(DEFAULT_OVERFLOW_DROP_TYPE))); public static final int MAX_RECORDS = Integer.parseInt( System.getProperty("org.apache.juli.AsyncMaxRecordCount", Integer.toString(DEFAULT_MAX_RECORDS))); public static final int LOGGER_SLEEP_TIME = Integer.parseInt( System.getProperty("org.apache.juli.AsyncLoggerPollInterval", Integer.toString(DEFAULT_LOGGER_SLEEP_TIME))); protected static final LinkedBlockingDeque