01: /*
02: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.rewriter;
06:
07: import java.util.logging.Logger;
08:
09: import java.lang.reflect.Method;
10:
11: public class RewriterLogger {
12: public static String LOGGER_CLASS = "com.sun.portal.log.common.PortalLogger";
13: public static String METHOD_NAME = "getLogger";
14:
15: // pass debug.com.sun.portal.rewriter.***
16: public static Logger getLogger(String name) {
17: try {
18: Class cls = RewriterLogger.class.getClassLoader()
19: .loadClass(LOGGER_CLASS);
20: Method[] methodlist = cls.getDeclaredMethods();
21: for (int i = 0; i < methodlist.length; i++) {
22: Method method = methodlist[i];
23: if (method.getName().equals(METHOD_NAME)) {
24: if (method.getParameterTypes().length == 1
25: && ((Class[]) method.getParameterTypes())[0]
26: .getName().equals(
27: "java.lang.String")) {
28: return (Logger) (method.invoke(cls
29: .newInstance(), new Object[] { name }));
30: }
31: }
32: }
33: } catch (Exception e) {
34: System.out.println(e);
35: e.printStackTrace();
36: }
37: return Logger.getLogger(name);
38: }
39: }
|