KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > logger > util > LoggerManagerTee


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
14  * implied.
15  *
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */

19 package org.apache.avalon.excalibur.logger.util;
20
21 import org.apache.avalon.excalibur.logger.LoggerManager;
22 import org.apache.avalon.framework.logger.Logger;
23
24 /**
25  * An AvalonTee object is not usefull by itself as it does not
26  * implement any component interface. Its primary use is to
27  * serve as a base class for objects proxing not only
28  * lifecycle but also some "meaningfull" interfaces.
29  * This object proxies LoggerManager interface.
30  *
31  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
32  * @version CVS $Revision: 1.3 $ $Date: 2004/03/10 13:54:51 $
33  * @since 4.0
34  */

35 public class LoggerManagerTee extends AvalonTee implements LoggerManager
36 {
37     /* The wrapped LoggerManager to delegate all the work to.*/
38     private final LoggerManager m_loggerManager;
39
40     /**
41      * Creates a new instance of LoggerManagerTee. Adds the supplied
42      * LoggerManager as the first tee. (It will receive the lifecycle
43      * events first of all tees).
44      */

45     public LoggerManagerTee( final LoggerManager loggerManager )
46     {
47         addTee( loggerManager );
48         m_loggerManager = loggerManager;
49     }
50
51     /**
52      * Return the Logger for the specified category.
53      */

54     public Logger getLoggerForCategory( final String JavaDoc categoryName )
55     {
56         return m_loggerManager.getLoggerForCategory( categoryName );
57     }
58
59     /**
60      * Return the default Logger. This is basically the same
61      * as getting the Logger for the "" category.
62      */

63     public Logger getDefaultLogger()
64     {
65         return m_loggerManager.getDefaultLogger();
66     }
67 }
68
Popular Tags