001/** 002 * Logback: the reliable, generic, fast and flexible logging framework. 003 * Copyright (C) 1999-2015, QOS.ch. All rights reserved. 004 * 005 * This program and the accompanying materials are dual-licensed under 006 * either the terms of the Eclipse Public License v1.0 as published by 007 * the Eclipse Foundation 008 * 009 * or (per the licensee's choosing) 010 * 011 * under the terms of the GNU Lesser General Public License version 2.1 012 * as published by the Free Software Foundation. 013 */ 014package ch.qos.logback.core.rolling; 015 016import java.io.File; 017import java.util.concurrent.atomic.AtomicLong; 018import java.util.concurrent.atomic.LongAdder; 019 020import ch.qos.logback.core.spi.LifeCycle; 021 022/** 023 * A <code>TriggeringPolicy</code> controls the conditions under which roll-over 024 * occurs. Such conditions include time of day, file size, an external event, 025 * the log request or a combination thereof. 026 * 027 * @author Ceki Gülcü 028 */ 029 030public interface TriggeringPolicy<E> extends LifeCycle { 031 032 /** 033 * Return the {@link LengthCounter} instance associated with this triggering 034 * policy. The returned value may be null. 035 * 036 * @return a LengthCounter instance, may be null 037 * @since 1.5.8 038 */ 039 default LengthCounter getLengthCounter() { 040 return null; 041 } 042 043 /** 044 * Should roll-over be triggered at this time? 045 * 046 * @param activeFile A reference to the currently active log file. 047 * @param event A reference to the current event. 048 * @return true if a roll-over should occur. 049 */ 050 boolean isTriggeringEvent(final File activeFile, final E event); 051}