net.sf.xbus.base.core.trace
Class Trace

java.lang.Object
  extended by net.sf.xbus.base.core.trace.Trace

public class Trace
extends java.lang.Object

Trace writes program-internal informations to a sink. The most important use of Trace is writing informations, when an error occurs, e.g. the queue-server is not available.


Field Summary
static int ALWAYS
           
static int DEBUG
           
static int ERROR
           
static int INFO
           
static int WARN
           
 
Constructor Summary
Trace()
           
 
Method Summary
static void always(java.lang.Object message)
          Traces a message object with the ALWAYS priority.
static void error(java.lang.Object message)
          Traces a message object with the ERROR priority.
static void error(java.lang.Object message, java.lang.Throwable t)
          Traces a message object with the ERROR priority including the stack trace of the Throwable t passed as parameter.
static void error(java.lang.Throwable t)
          Traces a message object with the ERROR priority including the message and the stack trace of the Throwable t passed as parameter.
static java.lang.String getTrace()
          Returns all trace messages as one large string.
static int getTracelevel()
           
static void info(java.lang.Object message)
          Traces a message object with the INFO priority.
static void initialize()
          The initialize() method reads the name and the level of the trace from the Configuration and initializes the Tracing
static boolean isInitialized()
          Tests if the Tracer is initialized.
static void warn(java.lang.Object message)
          Traces a message object with the WARN priority.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final int DEBUG
See Also:
Constant Field Values

INFO

public static final int INFO
See Also:
Constant Field Values

WARN

public static final int WARN
See Also:
Constant Field Values

ERROR

public static final int ERROR
See Also:
Constant Field Values

ALWAYS

public static final int ALWAYS
See Also:
Constant Field Values
Constructor Detail

Trace

public Trace()
Method Detail

always

public static void always(java.lang.Object message)
Traces a message object with the ALWAYS priority.

Parameters:
message - the message to be traced

error

public static void error(java.lang.Object message)
Traces a message object with the ERROR priority.

Parameters:
message - the message to be traced

error

public static void error(java.lang.Throwable t)
Traces a message object with the ERROR priority including the message and the stack trace of the Throwable t passed as parameter.

When the Throwable is an XException nothing happens, because the XException has been traced before.

Parameters:
t - the Throwable which shall be traced.

error

public static void error(java.lang.Object message,
                         java.lang.Throwable t)
Traces a message object with the ERROR priority including the stack trace of the Throwable t passed as parameter.

Parameters:
message - the message to be traced
t - the stack trace of the Throwable

warn

public static void warn(java.lang.Object message)
Traces a message object with the WARN priority.

Parameters:
message - the message to be traced

info

public static void info(java.lang.Object message)
Traces a message object with the INFO priority.

Parameters:
message - the message to be traced

initialize

public static void initialize()
The initialize() method reads the name and the level of the trace from the Configuration and initializes the Tracing

See Also:
Configuration.getValue(String,String,String)

getTrace

public static java.lang.String getTrace()
Returns all trace messages as one large string.

Returns:
String - all trace message

isInitialized

public static boolean isInitialized()
Tests if the Tracer is initialized.

Returns:
boolean - true: Trace is initialized

getTracelevel

public static int getTracelevel()
Returns:
current tracelevel