|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecteneter.messaging.diagnostic.EneterTrace
public class EneterTrace
Super duper trace. Example showing how to enable tracing of communication errors and warnings to a file:
EneterTrace.setDetailLevel(EneterTrace.EDetailLevel.Short); EneterTrace.setTraceLog(new PrintStream("D:\\Trace.txt"));Example showing how to enable tracing of detailed communication sequence to a file:
EneterTrace.setDetailLevel(EneterTrace.EDetailLevel.Debug); EneterTrace.setTraceLog(new PrintStream("D:\\Trace.txt"));Example showing how you can trace entering/leaving methods:
class MyClass { ...
void doSomething() { EneterTrace aTrace = EneterTrace.entering(); try { ... } finally { EneterTrace.leaving(aTrace); } } }
23:58:54.585 ~ 1 --> some.namespace.MyClass.doSomething
23:58:54.585 ~ 1 <-- some.namespace.MyClass.doSomething [0:0:0 0ms 5.0us]
Nested Class Summary | |
---|---|
static class |
EneterTrace.EDetailLevel
Detail level of the trace. |
Method Summary | |
---|---|
static void |
debug(int skipCallstackFrames,
java.lang.String message)
Traces the debug message. |
static void |
debug(java.lang.String message)
Traces the debug message. |
static EneterTrace |
entering()
Traces entering-leaving the method. |
static void |
error(java.lang.String message)
Traces the error message. |
static void |
error(java.lang.String message,
java.lang.String errorDetails)
Traces the error message and details for the error. |
static void |
error(java.lang.String message,
java.lang.Throwable err)
Traces the error message. |
static EneterTrace.EDetailLevel |
getDetailLevel()
Gets the detail level of the trace. |
static java.util.regex.Pattern |
getNameSpaceFilter()
Gets the regular expression that will be applied to the namespace to filter traced messages. |
static java.io.PrintStream |
getTraceLog()
Gets the user defined trace. |
static void |
info(java.lang.String message)
Traces the info message. |
static void |
info(java.lang.String message,
java.lang.String details)
Traces the information message and details. |
static void |
info(java.lang.String message,
java.lang.Throwable err)
Traces the info message. |
static void |
leaving(EneterTrace trace)
Traces the leaving from the method. |
static void |
setDetailLevel(EneterTrace.EDetailLevel value)
Sets the detail level of the trace. |
static void |
setNameSpaceFilter(java.util.regex.Pattern value)
Sets or gets the regular expression that will be applied to the namespace to filter traced messages. |
static void |
setTraceLog(java.io.PrintStream value)
Sets the user defined trace. |
static void |
warning(int skipCallstackFrames,
java.lang.String message)
Traces the warning message. |
static void |
warning(java.lang.String message)
Traces the warning message. |
static void |
warning(java.lang.String message,
java.lang.String details)
Traces the warning message and details |
static void |
warning(java.lang.String message,
java.lang.Throwable err)
Traces the warning message. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static EneterTrace entering()
public static void leaving(EneterTrace trace)
trace
- The reference obtained during the entering the method.public static void info(java.lang.String message)
message
- info messagepublic static void info(java.lang.String message, java.lang.String details)
message
- info messagedetails
- additional detailspublic static void info(java.lang.String message, java.lang.Throwable err)
message
- info messageerr
- exception that will be tracedpublic static void warning(java.lang.String message)
message
- warning messagepublic static void warning(int skipCallstackFrames, java.lang.String message)
skipCallstackFrames
- indicates how many fames from the stack shall be ignored
when evaluating the position in the stack.message
- warning messagepublic static void warning(java.lang.String message, java.lang.String details)
message
- warning messagedetails
- additional detailspublic static void warning(java.lang.String message, java.lang.Throwable err)
message
- warning messageerr
- exception that will be tracedpublic static void error(java.lang.String message)
message
- error messagepublic static void error(java.lang.String message, java.lang.String errorDetails)
message
- error messageerrorDetails
- additional detailspublic static void error(java.lang.String message, java.lang.Throwable err)
message
- error messageerr
- exception that will be tracedpublic static void debug(java.lang.String message)
message
- debug messagepublic static void debug(int skipCallstackFrames, java.lang.String message)
skipCallstackFrames
- indicates how many frames shall be skipped when evaluating the callstack.message
- debug messagepublic static java.io.PrintStream getTraceLog()
public static void setTraceLog(java.io.PrintStream value)
public static EneterTrace.EDetailLevel getDetailLevel()
public static void setDetailLevel(EneterTrace.EDetailLevel value)
value
- public static java.util.regex.Pattern getNameSpaceFilter()
public static void setNameSpaceFilter(java.util.regex.Pattern value)
value
- If the namespace matches with the regular expression, the message will be traced.
If the filter is set to null, then the filter is not used and all messages will be traced.
// Set the debug detailed level.
EneterTrace.DetailLevel = EneterTrace.EDetailLevel.Debug;
// Examples:
// Traces all name spaces starting with 'My.NameSpace'.
EneterTrace.NameSpaceFilter = Pattern.compile("^My\.NameSpace");
// Traces exactly the name space 'My.NameSpace'.
EneterTrace.NameSpaceFilter = Pattern.compile("^My\.NameSpace$");
// Traces name spaces starting with 'Calc.Methods' or 'App.Utilities'.
EneterTrace.NameSpaceFilter = Pattern.compile("^Calc\.Methods|^App\.Utilities");
// Traces all name spaces except namespaces starting with 'Eneter'.
EneterTrace.NameSpaceFilter = Pattern.compile("^(?!\bEneter\b)");
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |