com.creamtec.core

## Class TraceMgr

- java.lang.Object
- - com.creamtec.core.TraceMgr

-     public class TraceMgr
      extends java.lang.Object

  This class provides the basic tracing functionality, which at this point of time only allows to turn tracing on or off. However, the implementation can be extended to provide tracing based on classes and packages, which can be obtained from the object instance, that is passed to the trace method. Also, logging can also be directed to a file by extended the functionality of trace method

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `DEBUG` Global flag, indicating if the tracing is turned on (true) or off (false)
    `static int` | `DEFAULT_CLASS_LEVEL`
    `static boolean` | `DEFAULT_CLASS_TRACE_ENABLED`
    `static int` | `DEFAULT_CUTOFF_LEVEL`
    `static int` | `DEFAULT_ERROR_LEVEL`
    `static int` | `DEFAULT_TRACE_LEVEL`
    `static int` | `DEFAULT_WARNING_LEVEL`
    `static boolean` | `mPrintDate`
    `static java.lang.String` | `PROPERTIES_FILE_NAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TraceMgr()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `className(java.lang.Class cls, java.lang.String msg)`
    `static void` | `dumpSystemInfo()`
    `static int` | `getCutoffLevel()`
    `static java.lang.String` | `getExceptionText(java.lang.String msg, java.lang.Throwable x)` Returns the message, appended with the details of exception (exception type and text
    `static java.lang.String` | `getExceptionText(java.lang.String msg, java.lang.Throwable x, boolean detailed)`
    `static java.io.Writer` | `getFileWriter()` Returns the log file writer
    `static java.lang.String` | `getLogFileName()`
    `static int` | `getTraceLevel(java.lang.Class cls)` Returns true if the tracing is enabled for the given class
    `static int` | `getTraceLevel(java.lang.Object obj)` Returns true if the tracing is enabled for the given object
    `static boolean` | `getWriteToConsole()`
    `static boolean` | `getWriteToFile()`
    `static void` | `loadSettings()`
    `static void` | `newLine()` Outputs a new line
    `static void` | `printStackTrace()`
    `static void` | `printStackTrace(int cutoffLevel)`
    `static void` | `setCutoffLevel(int cutoffLevel)`
    `static void` | `setFileWriter(java.io.Writer writer)` Sets the file writer that will receive log messages Note: if there is an existing log file writer, it is the caller's responsibility to close it.
    `static void` | `setLoadSettings(boolean load)`
    `static void` | `setLogFileName(java.lang.String fileName)`
    `static void` | `setWriteToConsole(boolean write)`
    `static void` | `setWriteToFile(boolean write)`
    `static void` | `trace(java.lang.Class cls, java.lang.String msg)` Outputs a single trace to the application console window, prepended by the name of the class, that obj is instance of
    `static void` | `trace(java.lang.Class cls, java.lang.String msg, int level)`
    `static void` | `trace(java.lang.Class cls, java.lang.String msg, java.lang.Throwable x)` Outputs a single trace to the application console window, prepended by the name of the class, that obj is instance of; exception information is appended to the trace line to show the type of the exception and the exception text.
    `static void` | `trace(java.lang.Class cls, java.lang.String msg, java.lang.Throwable x, int level)`
    `static void` | `trace(java.lang.Object obj, java.lang.String msg)` Outputs a single trace to the application console window, prepended by the name of the class, that obj is instance of
    `static void` | `trace(java.lang.Object obj, java.lang.String msg, int level)`
    `static void` | `trace(java.lang.Object obj, java.lang.String msg, java.lang.Throwable x)` Outputs a single trace to the application console window, prepended by the name of the class, that obj is instance of; exception information is appended to the trace line to show the type of the exception and the exception text.
    `static void` | `trace(java.lang.Object obj, java.lang.String msg, java.lang.Throwable x, int level)`
    `static void` | `trace(java.lang.String msg)` Outputs a single trace to the console window
    `static void` | `trace(java.lang.String msg, int level)`
    `static void` | `trace(java.lang.String msg, java.lang.Throwable x)`
    `static void` | `trace(java.lang.String msg, java.lang.Throwable x, int level)`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEBUG

          public static final boolean DEBUG

      Global flag, indicating if the tracing is turned on (true) or off (false)
      See Also:
        Constant Field Values

    - #### mPrintDate

          public static boolean mPrintDate

    - #### DEFAULT_CLASS_TRACE_ENABLED

          public static final boolean DEFAULT_CLASS_TRACE_ENABLED

      See Also:
        Constant Field Values

    - #### DEFAULT_CUTOFF_LEVEL

          public static int DEFAULT_CUTOFF_LEVEL

    - #### DEFAULT_TRACE_LEVEL

          public static int DEFAULT_TRACE_LEVEL

    - #### DEFAULT_WARNING_LEVEL

          public static int DEFAULT_WARNING_LEVEL

    - #### DEFAULT_ERROR_LEVEL

          public static int DEFAULT_ERROR_LEVEL

    - #### DEFAULT_CLASS_LEVEL

          public static int DEFAULT_CLASS_LEVEL

    - #### PROPERTIES_FILE_NAME

          public static final java.lang.String PROPERTIES_FILE_NAME

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### TraceMgr

          public TraceMgr()

  - ### Method Detail

    - #### trace

          public static void trace(java.lang.String msg)

      Outputs a single trace to the console window
      Parameters:
        `msg` - text of the trace

    - #### trace

          public static void trace(java.lang.String msg,
                   int level)

    - #### getCutoffLevel

          public static int getCutoffLevel()

    - #### setCutoffLevel

          public static void setCutoffLevel(int cutoffLevel)

    - #### setFileWriter

          public static void setFileWriter(java.io.Writer writer)

      Sets the file writer that will receive log messages Note: if there is an existing log file writer, it is the caller's responsibility to close it. The writer will receive log messages even if the writing to file was turned off with setWriteToFile() method
      Parameters:
        `writer` - Writer

    - #### getFileWriter

          public static java.io.Writer getFileWriter()

      Returns the log file writer
      Returns:
        Writer

    - #### newLine

          public static void newLine()

      Outputs a new line

    - #### trace

          public static void trace(java.lang.Object obj,
                   java.lang.String msg)

      Outputs a single trace to the application console window, prepended by the name of the class, that obj is instance of
      Parameters:
        `obj` - object, that is outputing the trace
        `msg` - text of the trace

    - #### trace

          public static void trace(java.lang.Object obj,
                   java.lang.String msg,
                   int level)

    - #### trace

          public static void trace(java.lang.Object obj,
                   java.lang.String msg,
                   java.lang.Throwable x)

      Outputs a single trace to the application console window, prepended by the name of the class, that obj is instance of; exception information is appended to the trace line to show the type of the exception and the exception text. Exception stack trace is outputed at the end
      Parameters:
        `obj` - object, that is outputing the trace
        `msg` - text of the trace
        `x` - exception, that will be appended to the trace message

    - #### trace

          public static void trace(java.lang.Object obj,
                   java.lang.String msg,
                   java.lang.Throwable x,
                   int level)

    - #### trace

          public static void trace(java.lang.Class cls,
                   java.lang.String msg)

      Outputs a single trace to the application console window, prepended by the name of the class, that obj is instance of
      Parameters:
        `cls` - object, that is outputing the trace
        `msg` - text of the trace

    - #### trace

          public static void trace(java.lang.Class cls,
                   java.lang.String msg,
                   int level)

    - #### className

          public static java.lang.String className(java.lang.Class cls,
                                   java.lang.String msg)

    - #### trace

          public static void trace(java.lang.Class cls,
                   java.lang.String msg,
                   java.lang.Throwable x)

      Outputs a single trace to the application console window, prepended by the name of the class, that obj is instance of; exception information is appended to the trace line to show the type of the exception and the exception text. Exception stack trace is outputed at the end
      Parameters:
        `cls` - class, that is outputing the trace
        `msg` - text of the trace
        `x` - exception, that will be appended to the trace message

    - #### trace

          public static void trace(java.lang.Class cls,
                   java.lang.String msg,
                   java.lang.Throwable x,
                   int level)

    - #### trace

          public static void trace(java.lang.String msg,
                   java.lang.Throwable x)

    - #### trace

          public static void trace(java.lang.String msg,
                   java.lang.Throwable x,
                   int level)

    - #### getExceptionText

          public static java.lang.String getExceptionText(java.lang.String msg,
                                          java.lang.Throwable x)

      Returns the message, appended with the details of exception (exception type and text

    - #### getExceptionText

          public static java.lang.String getExceptionText(java.lang.String msg,
                                          java.lang.Throwable x,
                                          boolean detailed)

    - #### getTraceLevel

          public static final int getTraceLevel(java.lang.Object obj)

      Returns true if the tracing is enabled for the given object

    - #### getTraceLevel

          public static final int getTraceLevel(java.lang.Class cls)

      Returns true if the tracing is enabled for the given class

    - #### loadSettings

          public static void loadSettings()
                                   throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### dumpSystemInfo

          public static void dumpSystemInfo()

    - #### printStackTrace

          public static void printStackTrace()

    - #### printStackTrace

          public static void printStackTrace(int cutoffLevel)

    - #### setLogFileName

          public static void setLogFileName(java.lang.String fileName)

    - #### getLogFileName

          public static java.lang.String getLogFileName()

    - #### setLoadSettings

          public static void setLoadSettings(boolean load)

    - #### setWriteToFile

          public static void setWriteToFile(boolean write)

    - #### getWriteToFile

          public static boolean getWriteToFile()

    - #### setWriteToConsole

          public static void setWriteToConsole(boolean write)

    - #### getWriteToConsole

          public static boolean getWriteToConsole()

Copyright © 2000-2012 CreamTec LLC. All Rights Reserved.