public class TraceUtil extends Object
Configuration.enableTrace()/disableTrace()
prior to any operation on TraceUtil.
It uses TraceRecordFormatter for formatting the trace record.Constructor and Description |
---|
TraceUtil() |
Modifier and Type | Method and Description |
---|---|
static int |
getCurrentTraceLevel()
Gets the current trace level.
|
static char |
getFieldDelimiter()
Gets the current field delimiter used in formatting trace record.
|
static String |
getTraceRecordTag()
Gets the current trace record tag used in formatting of trace record.
|
static PrintWriter |
getTraceWriter()
Gets the current output writer.
|
static String |
getXAExceptionInfo(XAException exception,
Logger logger)
Returns details about Oracle XAException if available.
|
static void |
init(PrintWriter traceWriter)
Initialises the trace class with given output writer.
|
static void |
print(int traceLevel,
Object tid,
Object origin,
String msg)
This method formats and writes the trace record to current output writer.
|
static void |
print(int traceLevel,
Object origin,
String msg)
This method formats and writes the trace record to current output writer.
|
static void |
print(int traceLevel,
PrintWriter outWriter,
Object tid,
Object origin,
String msg)
This method formats and writes the trace record to output writer.
|
static void |
setCurrentTraceLevel(int traceLevel)
Sets the current trace level.
|
static void |
setFieldDelimiter(char delimiter)
Sets the current field delimiter.
|
static void |
setTraceRecordTag(String traceRecordTag)
Sets the trace record tag.
|
static void |
setTraceWriter(PrintWriter traceWriter)
Sets the output writer.
|
public static void init(PrintWriter traceWriter)
traceWriter
- an PrintWriter
valuepublic static void setTraceWriter(PrintWriter traceWriter)
traceWriter
- an PrintWriter
valuepublic static PrintWriter getTraceWriter()
PrintWriter
valuepublic static int getCurrentTraceLevel()
int
valuepublic static void setCurrentTraceLevel(int traceLevel) throws InvalidTraceLevelException
traceLevel
- an int
valueInvalidTraceLevelException
- if an error occurspublic static void print(int traceLevel, PrintWriter outWriter, Object tid, Object origin, String msg)
traceLevel
- an int
valueoutWriter
- an PrintWriter
valuetid
- an Object
valueorigin
- an Object
valuemsg
- a String
valuepublic static void print(int traceLevel, Object origin, String msg)
traceLevel
- an int
valueorigin
- an Object
valuemsg
- a String
valuepublic static void print(int traceLevel, Object tid, Object origin, String msg)
traceLevel
- an int
valuetid
- an Object
valueorigin
- an Object
valuemsg
- a String
valuepublic static char getFieldDelimiter()
char
valuepublic static void setFieldDelimiter(char delimiter)
delimiter
- a char
valuepublic static String getTraceRecordTag()
String
valuepublic static void setTraceRecordTag(String traceRecordTag)
traceRecordTag
- a String
valuepublic static String getXAExceptionInfo(XAException exception, Logger logger)
exception
- an XAException
to get info fromlogger
- the Logger
to use to report errors extracting the dataString
valueCopyright © 2020. All rights reserved.