Class TraceHandler

java.lang.Object
com.adobe.xfa.ut.trace.TraceHandler

public final class TraceHandler extends Object
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
                        ...
                }

 
  • 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

      public static void setAmendMsgCallback(TraceHandler.AmendMsgCallback callback, Object userData)
    • resetTiming

      public static void resetTiming()
    • resetTiming

      public static void resetTiming(TraceHandler.TimingType eType)
    • initializeTiming

      public static void initializeTiming()
    • reportScriptInfo

      public static void reportScriptInfo(String sMsg)
    • reportTimingResults

      public static void reportTimingResults(boolean bClearStoppedTimers)
    • getTimerMilliseconds

      public static long getTimerMilliseconds(TraceHandler.TimingType eType)
    • getTraceHandler

      public static TraceHandler getTraceHandler()
      Get the TraceHandler for the current thread.
      Returns:
      the TraceHandler assigned to the current thread.
    • registerTraceHandler

      public static void registerTraceHandler(TraceHandler traceHandler)
      Registers the trace handler for the current thread.
    • unregisterTraceHandler

      public static void unregisterTraceHandler()
      Unregisters a trace handler for the current thread.
    • activate

      public void activate(Trace trace, int nLevel)
      Activates a trace section
      Parameters:
      trace - a globally defined Trace object
      nLevel - the detail level of the messages allowed, higher the level greater the detail
    • activate

      public void activate(String sName, int nLevel)
      Activates a trace section
      Parameters:
      sName - the name of a globally defined Trace object
      nLevel - the detail level of the messages allowed higher the level greater the detail
    • activate

      public void activate(String sNamesAndLevels)
      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

      public void deactivate(String sName)
      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

      public boolean isTimerActive(TraceHandler.TimingType eType)