KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jmanage > core > util > Loggers


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

16 package org.jmanage.core.util;
17
18 import java.util.logging.Logger JavaDoc;
19
20 /**
21  * A helper class that is used for getting the logger for making log calls.
22  *
23  * date: Aug 17, 2004
24  * @author Rakesh Kalra
25  */

26 public class Loggers {
27
28     /**
29      * Returns a logger based on the package name. Every package has a shared
30      * logger.
31      * <p>
32      * The logger in jmanage code, must be retrieved by calling this method.
33      *
34      * @param clazz the class that wants to use the logger
35      * @return Logger instance for the package containing the class
36      */

37     public static Logger JavaDoc getLogger(Class JavaDoc clazz){
38         if(clazz == null){
39             // this condition will happen if the class has not been initialized
40
return Logger.global;
41         }
42         return Logger.getLogger(clazz.getPackage().getName());
43     }
44 }
45
Popular Tags