The com.ibm.db2.jcc.DB2TraceManager class controls the global log writer.
The global log writer is driver-wide, and applies to all connections. The global log writer overrides any other JDBC log writers. In addition to starting the global log writer, the DB2TraceManager class provides the ability to suspend and resume tracing of any type of log writer. That is, the suspend and resume methods of the DB2TraceManager class apply to all current and future DriverManager log writers, DataSource log writers, or IBM® Data Server Driver for JDBC and SQLJ-only connection-level log writers.
static public DB2TraceManager getTraceManager()
throws java.sql.SQLException
Gets an instance of the global log writer.
public abstract void setLogWriter(String traceDirectory,
String baseTraceFileName, int traceLevel)
throws java.sql.SQLException
public abstract void setLogWriter(String traceFile,
boolean fileAppend, int traceLevel)
throws java.sql.SQLException
public abstract void setLogWriter(java.io.PrintWriter logWriter,
int traceLevel)
throws java.sql.SQLException
Enables a global trace. After setLogWriter is called, all calls for DataSource or Connection traces are discarded until DB2TraceManager.unsetLogWriter is called.
When setLogWriter is called, all future Connection or DataSource traces are redirected to a trace file or PrintWriter, depending on the form of setLogWriter that you use. If the global trace is suspended when setLogWriter is called, the specified settings take effect when the trace is resumed.
n is the nth JDBC driver connection.
baseTraceFileName is the value of the baseTraceFileName parameter.
n is the nth JDBC driver connection.
When the form of setLogWriter with the traceFileName parameter is used, only one log file is written.
traceFileName can include a directory path.
This value overrides the logWriter property on a DataSource or DriverManager connection.
TRACE_DRDA_FLOWS|TRACE_CONNECTION_CALLS
~TRACE_DRDA_FLOWS
public abstract void unsetLogWriter()
throws java.sql.SQLException
Disables the global log writer override for future connections.
public void suspendTrace()
throws java.sql.SQLException
Suspends all global, Connection-level, or DataSource-level traces for current and future connections. suspendTrace can be called when the global log writer is enabled or disabled.
public void resumeTrace()
throws java.sql.SQLException
Resumes all global, Connection-level, or DataSource-level traces for current and future connections. resumeTrace can be called when the global log writer is enabled or disabled. If the global log writer is disabled, resumeTrace resumes Connection-level or DataSource-level traces. If the global log writer is enabled, resumeTrace resumes the global trace.
public abstract java.io.PrintWriter getLogWriter()
throws java.sql.SQLException
Returns the PrintWriter for the global log writer, if it is set. Otherwise, getLogWriter returns null.
public abstract String getTraceFile()
throws java.sql.SQLException
Returns the name of the destination file for the global log writer, if it is set. Otherwise, getTraceFile returns null.
public abstract String getTraceDirectory()
throws java.sql.SQLException
Returns the name of the destination directory for global log writer files, if it is set. Otherwise, getTraceDirectory returns null.
public abstract int getTraceLevel()
throws java.sql.SQLException
Returns the trace level for the global trace, if it is set. Otherwise, getTraceLevel returns -1 (TRACE_ALL).
public abstract boolean getTraceFileAppend()
throws java.sql.SQLException
Returns true if the global trace records are appended to the trace file. Otherwise, getTraceFileAppend returns false.