com.cloudtran.util
Class Trace

java.lang.Object
  extended by com.cloudtran.util.Trace

public class Trace
extends Object

Utilities for tracing. These give trace information formatted to assist in multi-machine, multi-thread debugging.


Nested Class Summary
static interface Trace.Logger
           
 
Field Summary
static Boolean ADJUSTNANOTIMER
           
static boolean ASSERT
           
static String computerName
           
static boolean DEBUG
           
static boolean EVENTHISTORY
           
static boolean formatForDiff
           
static boolean iAmPrimaryTimeSource
           
static String[] indents
           
static boolean INFO
           
static long INVALID_DELTA
           
static long mapMyNanoTimeToWallTimeMillis
           
static boolean MESSAGES
           
 ArrayList<String> methodList
           
static String moduleName
           
static int NTA_COUNTER
           
static boolean OPERATION_TIMER
           
static boolean POF
           
static boolean PRODUCTION
           
static Trace.Logger theLogger
           
static boolean TRACE
           
 String traceIndent
           
static boolean TXEVENT
           
static boolean WARN
           
static boolean WIRESHARK
           
 
Constructor Summary
Trace()
           
 
Method Summary
static void Assert(boolean assertion)
          This is the default implementation of the logger.
static void flush()
          Flush the output stream, wherever it is going
static String getLogText(String s, Throwable e)
           
static String getMyCallersLocation()
           
static String getStack()
          Returns the caller's stack as a String, in stack dump format This is equivalent to getStack(1).
static String getStack(int n)
           
static String getTOD()
           
static void log(String s)
           
static void log(String s, Throwable e)
          1.
static void logStack()
           
static void logStack(int n)
           
static String n00(long i)
          Write a long, in a field of 2, 0-justified
static String n000(long i)
          Write a long, in a field of 3, 0-justified
static void setLoggerObject(Trace.Logger newLogger)
           
static void setModuleName(String s)
          sets the module name to identify trace - e.g.
static void sleepNoException(long millis)
          Sleep for the target milliseconds.
static void trace(String s)
           
static void trace(String s, Throwable e)
           
static void TraceAsyncBegin()
          Use this method at the start of Asynchronous sequences like - DelayableEPBase.process() Invocable.run()
 void TraceBegin_NonStatic(StackTraceElement ste, String methodName)
           
static void TraceBegin()
           
static void TraceBegin(String methodName)
           
static void traceClear()
          Use this method in threads with loops that read a queue and then process stuff.
 void TraceEnd_NonStatic()
           
static void TraceEnd()
           
static void traceX(String s)
          This dumps the input string without any leading identification
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ADJUSTNANOTIMER

public static final Boolean ADJUSTNANOTIMER

PRODUCTION

public static final boolean PRODUCTION

TRACE

public static final boolean TRACE

DEBUG

public static final boolean DEBUG

ASSERT

public static final boolean ASSERT

INFO

public static final boolean INFO

WARN

public static final boolean WARN

POF

public static final boolean POF

TXEVENT

public static final boolean TXEVENT

WIRESHARK

public static final boolean WIRESHARK

MESSAGES

public static final boolean MESSAGES

OPERATION_TIMER

public static volatile boolean OPERATION_TIMER

EVENTHISTORY

public static boolean EVENTHISTORY

mapMyNanoTimeToWallTimeMillis

public static long mapMyNanoTimeToWallTimeMillis

formatForDiff

public static boolean formatForDiff

iAmPrimaryTimeSource

public static boolean iAmPrimaryTimeSource

computerName

public static final String computerName

indents

public static String[] indents

moduleName

public static String moduleName

theLogger

public static Trace.Logger theLogger

traceIndent

public String traceIndent

methodList

public ArrayList<String> methodList

NTA_COUNTER

public static final int NTA_COUNTER
See Also:
Constant Field Values

INVALID_DELTA

public static final long INVALID_DELTA
See Also:
Constant Field Values
Constructor Detail

Trace

public Trace()
Method Detail

setModuleName

public static void setModuleName(String s)
sets the module name to identify trace - e.g. "CLIENT" by default, or "TxB" or "Coh". This will be overridden by the caller's 'trace.module' config property if present.


traceX

public static void traceX(String s)
This dumps the input string without any leading identification


trace

public static void trace(String s,
                         Throwable e)

flush

public static void flush()
Flush the output stream, wherever it is going


TraceBegin

public static void TraceBegin(String methodName)

TraceBegin

public static void TraceBegin()

TraceAsyncBegin

public static void TraceAsyncBegin()
Use this method at the start of Asynchronous sequences like - DelayableEPBase.process() Invocable.run()


traceClear

public static void traceClear()
Use this method in threads with loops that read a queue and then process stuff.


TraceBegin_NonStatic

public void TraceBegin_NonStatic(StackTraceElement ste,
                                 String methodName)

TraceEnd_NonStatic

public void TraceEnd_NonStatic()

TraceEnd

public static void TraceEnd()

trace

public static void trace(String s)

log

public static void log(String s)

log

public static void log(String s,
                       Throwable e)
1. Possible log to System.out - if that is not our current log target 2. Log to current target for logs in formatted lines. The String 's' parameter can be null, to prevent an extra message.


setLoggerObject

public static void setLoggerObject(Trace.Logger newLogger)

getLogText

public static String getLogText(String s,
                                Throwable e)

Assert

public static void Assert(boolean assertion)
This is the default implementation of the logger.


getMyCallersLocation

public static String getMyCallersLocation()

n00

public static String n00(long i)
Write a long, in a field of 2, 0-justified


n000

public static String n000(long i)
Write a long, in a field of 3, 0-justified


sleepNoException

public static void sleepNoException(long millis)
Sleep for the target milliseconds. If interrupted, return - presumably that is because someone wants to stop us.


getTOD

public static String getTOD()

logStack

public static void logStack()

logStack

public static void logStack(int n)

getStack

public static String getStack()
Returns the caller's stack as a String, in stack dump format This is equivalent to getStack(1).


getStack

public static String getStack(int n)