01: /*
02: * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.sra.admin.context;
06:
07: import java.io.File;
08: import java.io.IOException;
09: import java.util.logging.FileHandler;
10: import java.util.logging.Logger;
11:
12: public class DebugContext {
13: public DebugContext() {
14: }
15:
16: public static Logger getInstance() {
17: return debug;
18: }
19:
20: public static void error(String error) {
21: System.out.println(error);
22: debug.severe(error);
23: }
24:
25: public static Boolean messageEnabled() {
26: return debug.isLoggable(debug.getLevel()) ? Boolean.TRUE
27: : Boolean.FALSE;
28: }
29:
30: public static void message(String message) {
31: System.out.println(message);
32: debug.info(message);
33: }
34:
35: private static Logger debug = null;
36:
37: static {
38: try {
39: debug = Logger.getLogger("com.sun.portal");
40: debug.setUseParentHandlers(false);
41: debug.addHandler(new FileHandler(System
42: .getProperty("java.io.tmpdir")
43: + File.separator + "srambeans.log"));
44: } catch (IOException ioe) {
45: System.out
46: .println("Was unable to set the logging file path ..");
47: }
48: }
49: }
|