org.jacorb.util
Class Debug

java.lang.Object
  extended byorg.jacorb.util.Debug

public final class Debug
extends java.lang.Object

Central anchor class to retrieve loggers, or to log messages directly. This class acts as a facde and shields clients from the actual log mechanisms. In its current state of evolution, it returns Apache Avalong loggers, which permit still other log backends, such as Apache logkit, which is the current default. The actual creation of logger instances based on configuration parameters is done in Environment, however.

Version:
$Id: Debug.java,v 1.17 2004/01/30 13:34:33 nick.cross Exp $
Author:
Gerald Brose

Constructor Summary
Debug()
           
 
Method Summary
static org.apache.avalon.framework.logger.Logger getNamedLogger(java.lang.String name)
          Convenience method.
static org.apache.avalon.framework.logger.Logger getNamedRootLogger(java.lang.String name)
          Convenience method.
static void initialize()
           
static boolean isDebugEnabled()
          isDebugEnabled allows fast efficient checking of whether debug is enabled.
static void output(int msg_level, java.lang.String msg)
          Deprecated. As this method can be inefficient for debug statements use isDebugEnabled and output(String) methods in the form: if (Debug.isDebugEnabled ()) { Debug.output ("" + value); }
static void output(int msg_level, java.lang.String name, byte[] bs)
          Deprecated. As this method can be inefficient for debug statements use isDebugEnabled and output(String,byte[]) methods in the form: if (Debug.isDebugEnabled ()) { Debug.output ("", value); }
static void output(int msg_level, java.lang.String name, byte[] bs, int len)
          Output a buffer in hex format to System.out.
static void output(int msg_level, java.lang.String name, byte[] bs, int start, int len)
          Output a buffer in hex format to System.out.
static void output(int msg_level, java.lang.Throwable e)
          convenience method to output stack traces
static void output(java.lang.String msg)
          output the following message.
static void output(java.lang.String name, byte[] bs)
          output a buffer in hex format.
static char toAscii(byte b)
           
static java.lang.String toHex(byte b)
          toHex converts a byte into a readable string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Debug

public Debug()
Method Detail

initialize

public static final void initialize()

isDebugEnabled

public static boolean isDebugEnabled()
isDebugEnabled allows fast efficient checking of whether debug is enabled. This ensures any inefficient String concatenations can be done inside an if statement. @see output(int,String) output(int,String)

Returns:
a boolean value

output

public static void output(java.lang.String msg)
output the following message. Useful in conjunction with canOutput or isDebugEnabled.


output

public static final void output(int msg_level,
                                java.lang.String msg)
Deprecated. As this method can be inefficient for debug statements use isDebugEnabled and output(String) methods in the form: if (Debug.isDebugEnabled ()) { Debug.output ("" + value); }

output a message.

Parameters:
msg_level - an int value
msg - a String value

output

public static void output(int msg_level,
                          java.lang.String name,
                          byte[] bs)
Deprecated. As this method can be inefficient for debug statements use isDebugEnabled and output(String,byte[]) methods in the form: if (Debug.isDebugEnabled ()) { Debug.output ("", value); }

Output a buffer in hex format. Note that output synchronizes the calling threads in order to avoid garbled debug output.


output

public static void output(java.lang.String name,
                          byte[] bs)
output a buffer in hex format. Useful in conjunction with canOutput or isDebugEnabled. Note that output synchronizes the calling threads in order to avoid garbled debug output

Parameters:
bs - a byte[] value

output

public static void output(int msg_level,
                          java.lang.String name,
                          byte[] bs,
                          int len)
Output a buffer in hex format to System.out. Note that output synchronizes the calling threads in order to avoid garbled debug output.


output

public static void output(int msg_level,
                          java.lang.String name,
                          byte[] bs,
                          int start,
                          int len)
Output a buffer in hex format to System.out. Note that output synchronizes the calling threads in order to avoid garbled debug output.


toHex

public static final java.lang.String toHex(byte b)
toHex converts a byte into a readable string.

Parameters:
b - a byte value
Returns:
a String value

toAscii

public static final char toAscii(byte b)

output

public static final void output(int msg_level,
                                java.lang.Throwable e)
convenience method to output stack traces


getNamedLogger

public static org.apache.avalon.framework.logger.Logger getNamedLogger(java.lang.String name)
Convenience method. Factory for logger instances, delegates to the actual factory set up in org.jacorb.util.Environment.


getNamedRootLogger

public static org.apache.avalon.framework.logger.Logger getNamedRootLogger(java.lang.String name)
Convenience method. Factory for logger instances, delegates to the actual factory set up in org.jacorb.util.Environment.