KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > avalon > excalibur > component > LogkitLoggerManager


1 /*
2  * Copyright 2002-2004 The Apache Software Foundation
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12  * implied.
13  *
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */

17 package org.apache.avalon.excalibur.component;
18
19 import org.apache.avalon.excalibur.logger.LogKitManager;
20 import org.apache.avalon.excalibur.logger.LoggerManager;
21 import org.apache.avalon.framework.logger.LogKitLogger;
22 import org.apache.avalon.framework.logger.Logger;
23
24 /**
25  * An adapter class to help with backwards comaptability.
26  *
27  * @deprecated ECM is no longer supported
28  *
29  * @author <a HREF="mailto:dev@avalon.apache.org">Avalon Development Team</a>
30  * @version $Revision: 1.5 $ $Date: 2004/02/28 11:47:14 $
31  */

32 public class LogkitLoggerManager
33     implements LoggerManager
34 {
35     private LoggerManager m_loggerManager;
36     private LogKitManager m_logKitManager;
37
38     public LogkitLoggerManager( final LoggerManager loggerManager,
39                                 final LogKitManager logKitManager )
40     {
41         m_loggerManager = loggerManager;
42         m_logKitManager = logKitManager;
43     }
44
45     public org.apache.log.Logger getLogKitLoggerForCategory( final String JavaDoc categoryName )
46     {
47         return getLogKitManager().getLogger( categoryName );
48     }
49
50     public Logger getLoggerForCategory( String JavaDoc categoryName )
51     {
52         if( null != m_loggerManager )
53         {
54             return m_loggerManager.getLoggerForCategory( categoryName );
55         }
56         else
57         {
58             return new LogKitLogger( getLogKitLoggerForCategory( categoryName ) );
59         }
60     }
61
62     public Logger getDefaultLogger()
63     {
64         return getLoggerForCategory( "" );
65     }
66
67     LogKitManager getLogKitManager()
68     {
69         if( null == m_logKitManager )
70         {
71             m_logKitManager = new Logger2LogKitManager( m_loggerManager );
72         }
73         return m_logKitManager;
74     }
75 }
76
Popular Tags