View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.log4j.spi;
19  
20  import org.apache.log4j.Level;
21  
22  /**
23   * An interface that defines the required methods for supporting the
24   * setting and getting of a level threshold.  Components should implement
25   * this interface if logging events they process should meet a certain
26   * threshold before being processed further.  Examples of this are
27   * Appenders and Receivers which will not process logging events unless
28   * the event level is at or greater than a set threshold level.
29   *
30   * @author Paul Smith (psmith@apache.org)
31   * @author Mark Womack
32   */
33  public interface Thresholdable {
34      /**
35       * Sets the component theshold to the given level.
36       *
37       * @param level The threshold level events must equal or be greater
38       *              than before further processing can be done.
39       */
40      void setThreshold(Level level);
41  
42      /**
43       * Gets the current threshold setting of the component.
44       *
45       * @return Level The current threshold level of the component.
46       */
47      Level getThreshold();
48  
49      /**
50       * Returns true if the given level is equals or greater than the current
51       * threshold value of the component.
52       *
53       * @param level The level to test against the component threshold.
54       * @return boolean True if level is equal or greater than the
55       * component threshold.
56       */
57      boolean isAsSevereAsThreshold(Level level);
58  }