01: /**
02: * Copyright 2004 Sun Microsystems, Inc. All
03: * rights reserved. Use of this product is subject
04: * to license terms. Federal Acquisitions:
05: * Commercial Software -- Government Users
06: * Subject to Standard License Terms and
07: * Conditions.
08: *
09: * Sun, Sun Microsystems, the Sun logo, and Sun ONE
10: * are trademarks or registered trademarks of Sun Microsystems,
11: * Inc. in the United States and other countries.
12: */package com.sun.portal.log.common;
13:
14: /**
15: * This file is used to log any statements from within the logging module to System.out only if the
16: * System property com.sun.portal.log.debug=true.
17: */
18:
19: public class PortalLogDebug {
20: public static final String LOG_DEBUG_PROPERTY = "com.sun.portal.log.debug";
21: protected static boolean debugEnabled = false;
22:
23: static {
24: String value = System.getProperty(LOG_DEBUG_PROPERTY);
25: if (value != null && value.equals("true"))
26: debugEnabled = true;
27: }
28:
29: public static void info(String message) {
30: if (debugEnabled)
31: System.err.println(message);
32: }
33:
34: public static void error(String message) {
35: if (debugEnabled)
36: System.err.println("ERROR: " + message);
37: }
38:
39: public static void error(Throwable t) {
40: if (debugEnabled)
41: System.err.println(t);
42: }
43: }
|