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.spi; 019 020import org.apache.log4j.Appender; 021import java.util.Enumeration; 022 023/** 024 Interface for attaching appenders to objects. 025 026 @author Ceki Gülcü 027 @since 0.9.1 */ 028public interface AppenderAttachable { 029 030 /** 031 Add an appender. 032 */ 033 public 034 void addAppender(Appender newAppender); 035 036 /** 037 Get all previously added appenders as an Enumeration. */ 038 public 039 Enumeration getAllAppenders(); 040 041 /** 042 Get an appender by name. 043 */ 044 public 045 Appender getAppender(String name); 046 047 048 /** 049 Returns <code>true</code> if the specified appender is in list of 050 attached attached, <code>false</code> otherwise. 051 052 @since 1.2 */ 053 public 054 boolean isAttached(Appender appender); 055 056 /** 057 Remove all previously added appenders. 058 */ 059 void removeAllAppenders(); 060 061 062 /** 063 Remove the appender passed as parameter from the list of appenders. 064 */ 065 void removeAppender(Appender appender); 066 067 068 /** 069 Remove the appender with the name passed as parameter from the 070 list of appenders. 071 */ 072 void 073 removeAppender(String name); 074} 075