01: /**
02: * Copyright 2004-2005 jManage.org
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: */package org.jmanage.core.util;
16:
17: import java.util.logging.Logger;
18:
19: /**
20: * A helper class that is used for getting the logger for making log calls.
21: *
22: * date: Aug 17, 2004
23: * @author Rakesh Kalra
24: */
25: public class Loggers {
26:
27: /**
28: * Returns a logger based on the package name. Every package has a shared
29: * logger.
30: * <p>
31: * The logger in jmanage code, must be retrieved by calling this method.
32: *
33: * @param clazz the class that wants to use the logger
34: * @return Logger instance for the package containing the class
35: */
36: public static Logger getLogger(Class clazz) {
37: if (clazz == null) {
38: // this condition will happen if the class has not been initialized
39: return Logger.global;
40: }
41: return Logger.getLogger(clazz.getPackage().getName());
42: }
43: }
|