001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 * 
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 * 
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package org.apache.log4j.varia;
019
020import org.apache.log4j.spi.Filter;
021import org.apache.log4j.spi.LoggingEvent;
022
023
024/**
025   This filter drops all logging events. 
026
027   <p>You can add this filter to the end of a filter chain to
028   switch from the default "accept all unless instructed otherwise"
029   filtering behaviour to a "deny all unless instructed otherwise"
030   behaviour.
031
032
033   @author Ceki G&uuml;lc&uuml;
034
035   @since 0.9.0 */
036public class DenyAllFilter extends Filter {
037
038  /**
039     Returns <code>null</code> as there are no options.
040     
041     @deprecated We now use JavaBeans introspection to configure
042     components. Options strings are no longer needed.
043  */
044  public
045  String[] getOptionStrings() {
046    return null;
047  }
048
049  
050  /**
051     No options to set.
052     
053     @deprecated Use the setter method for the option directly instead
054     of the generic <code>setOption</code> method. 
055  */
056  public
057  void setOption(String key, String value) {
058  }
059  
060  /**
061     Always returns the integer constant {@link Filter#DENY}
062     regardless of the {@link LoggingEvent} parameter.
063
064     @param event The LoggingEvent to filter.
065     @return Always returns {@link Filter#DENY}.
066  */
067  public
068  int decide(LoggingEvent event) {
069    return Filter.DENY;
070  }
071}
072