01: /*
02: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
03: *
04: * Copyright 1997-2007 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * The contents of this file are subject to the terms of the Common
07: * Development and Distribution License ("CDDL")(the "License"). You
08: * may not use this file except in compliance with the License.
09: *
10: * You can obtain a copy of the License at
11: * https://open-esb.dev.java.net/public/CDDLv1.0.html
12: * or mural/license.txt. See the License for the specific language
13: * governing permissions and limitations under the License.
14: *
15: * When distributing Covered Code, include this CDDL Header Notice
16: * in each file and include the License file at mural/license.txt.
17: * If applicable, add the following below the CDDL Header, with the
18: * fields enclosed by brackets [] replaced by your own identifying
19: * information: "Portions Copyrighted [year] [name of copyright owner]"
20: */
21: package org.netbeans.modules.etl.logger;
22:
23: import net.java.hulp.i18n.Logger;
24:
25: /**
26: * Log utility functions customized for DataIntegrator
27: * This class creates a mapping from packages to Component name
28: * and gives a jdk logger instance given a class name
29: * @author srengara@dev.java.net
30: */
31: public class LogUtil {
32: /** Logger prefix */
33: public static final String DATAINTEGRATOR_LOG_PREFIX = "SUN.DM.DI";
34:
35: /**
36: * This method returns an instance of <code>java.util.Logger</code> given a class name
37: * @param className
38: * @return logger instance
39: **/
40: public static Logger getLogger(String className) {
41: return getLogger(LogUtil.DATAINTEGRATOR_LOG_PREFIX, className);
42: }
43:
44: /** Get logger for given object and prefix
45: * @param logPrefix
46: * @param className class name
47: * @return logger
48: */
49: public static Logger getLogger(String logPrefix, String className) {
50: if (logPrefix == null || "".equalsIgnoreCase(logPrefix)) {
51: logPrefix = LogUtil.DATAINTEGRATOR_LOG_PREFIX;
52: }
53: //String componentName = (String) sLogMapping.getObjectValue(className);
54: return Logger.getLogger(logPrefix + "." + className);
55: }
56: }
|