Package com.adobe.xfa.ut.trace
Class TraceHandler
java.lang.Object
com.adobe.xfa.ut.trace.TraceHandler
This trace handler class manages Trace areas for a given thread and
outputs trace messages to standard out.
If an application uses tracing it should create one instance of this class for
each thread.
example:
Trace dataTrace = new Trace("data", ResId.DataTraceHelp);
Trace stringTrace = new Trace("string" ResId.StringTraceHelp);
main(...)
{
TraceHandler traceHandler = new TraceHandler();
TraceHandler.registerTraceHandler(traceHandler);
// three ways to activate
traceHandler.activate("data", 2);
traceHandler.activate("data:2 eval:3 signature:1");
stringTrace.activate(3);
...
traceHandler.trace(dataTrace, 2, 27, "data msg"); // issue message
...
dataTrace.trace(2, 33, "string msg"); // issue message
...
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidActivates a trace sectionvoidActivates one or more trace sectionsvoidActivates a trace sectionvoiddeactivate(String sName) Deactivates a trace sectionintGet the thread ID of this TraceHandlerstatic longstatic TraceHandlerGet the TraceHandler for the current thread.static voidbooleanstatic voidregisterTraceHandler(TraceHandler traceHandler) Registers the trace handler for the current thread.static voidreportScriptInfo(String sMsg) static voidreportTimingResults(boolean bClearStoppedTimers) static voidstatic voidstatic booleanstatic voidsetAmendMsgCallback(TraceHandler.AmendMsgCallback callback, Object userData) static booleanstatic voidtimingTraceEnabled(boolean bEnabled) static voidUnregisters a trace handler for the current thread.
-
Constructor Details
-
TraceHandler
public TraceHandler(int nThreadId) Constructor- Parameters:
nThreadId- the thread id of the current thread
-
-
Method Details
-
timingTraceEnabled
public static void timingTraceEnabled(boolean bEnabled) -
timingTraceEnabled
public static boolean timingTraceEnabled() -
scriptLoggingEnabled
public static boolean scriptLoggingEnabled() -
setAmendMsgCallback
-
resetTiming
public static void resetTiming() -
resetTiming
-
initializeTiming
public static void initializeTiming() -
reportScriptInfo
-
reportTimingResults
public static void reportTimingResults(boolean bClearStoppedTimers) -
getTimerMilliseconds
-
getTraceHandler
Get the TraceHandler for the current thread.- Returns:
- the TraceHandler assigned to the current thread.
-
registerTraceHandler
Registers the trace handler for the current thread. -
unregisterTraceHandler
public static void unregisterTraceHandler()Unregisters a trace handler for the current thread. -
activate
Activates a trace section- Parameters:
trace- a globally defined Trace objectnLevel- the detail level of the messages allowed, higher the level greater the detail
-
activate
Activates a trace section- Parameters:
sName- the name of a globally defined Trace objectnLevel- the detail level of the messages allowed higher the level greater the detail
-
activate
Activates one or more trace sections- Parameters:
sNamesAndLevels- the whitespace-separated list of trace names and the associated detail level. For example: "eval:2 signature:1". This is the same format as a command line argument, so the argument following the -trace argument (by convention) can be passed to this method.
-
deactivate
Deactivates a trace section- Parameters:
sName- the name of a globally defined Trace object
-
getThreadId
public int getThreadId()Get the thread ID of this TraceHandler- Returns:
- thread ID
-
isTimerActive
-