OpenOffice.org
XMerge API

org.openoffice.xmerge.util
Class Debug

java.lang.Object
  |
  +--org.openoffice.xmerge.util.Debug

public final class Debug
extends java.lang.Object

This class is used for logging debug messages. Currently, there are three types of logging: INFO, TRACE & ERROR. Use the Debug.properties file to set or unset each type. Also use Debug.properties to set the writer to either System.out, System.err, or to a file.


Field Summary
static int ERROR
          Error messages.
static int INFO
          Informational messages.
static boolean SET
          To set a flag.
static int TRACE
          Trace messages.
static boolean UNSET
          To unset a flag.
 
Method Summary
static java.lang.String byteArrayToHexString(byte[] bytes)
          Converts the given bytes to a String of Hex digits.
static boolean isFlagSet(int f)
          Checks if flag is set.
static void log(int flag, java.lang.String msg)
          Log message based on the flag type.
static void log(int flag, java.lang.String msg, java.lang.Throwable e)
          Log message based on flag type plus print out stack trace of the exception passed in.
static void logSystemInfo()
          Prints out information regarding platform.
static void logTime()
          Prints out timestamp.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR

public static final int ERROR
Error messages.

INFO

public static final int INFO
Informational messages.

SET

public static final boolean SET
To set a flag.

TRACE

public static final int TRACE
Trace messages.

UNSET

public static final boolean UNSET
To unset a flag.
Method Detail

byteArrayToHexString

public static java.lang.String byteArrayToHexString(byte[] bytes)
Converts the given bytes to a String of Hex digits.
Parameters:
bytes - byte array.
Returns:
Hex representation in a String.

isFlagSet

public static boolean isFlagSet(int f)
Checks if flag is set.
Returns:
true if info logging is on, otherwise false

log

public static void log(int flag,
                       java.lang.String msg)

Log message based on the flag type.

Example 1:


  Debug.log(Debug.INFO, "info string here");
  

This logs the message during runtime if debug.info in the properties file is set to true.

Example 2:


  Debug.log(Debug.INFO | Debug.TRACE, "info string here");
  

This logs the message during runtime if debug.info or debug.trace in the properties file is set to true.

Parameters:
int - Log type, one of the Debug constants INFO, TRACE, ERROR or a combination of which or'ed together.
msg - The message.

log

public static void log(int flag,
                       java.lang.String msg,
                       java.lang.Throwable e)
Log message based on flag type plus print out stack trace of the exception passed in. Refer to the other log method for description.
Parameters:
int - Log type, one of the Debug constants INFO, TRACE, ERROR or a combination of which or'ed together.
msg - The message.
e - Throwable object.

logSystemInfo

public static void logSystemInfo()
Prints out information regarding platform.

logTime

public static void logTime()
Prints out timestamp.

OpenOffice.org
XMerge API

Copyright © 2002 OpenOffice.org