|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.triactive.jdo.jdbc.trace.Trace
Provides tracing of JDBC activity.
A trace object is configured to enable or disable the logging of various kinds of JDBC activity, such as the execution time of SQL statements. The traceConnection() method is then used to apply the tracing to a given connection. A low-overhead wrapper is placed around the connection and its related objects to perform the logging. All log output is sent to a log category called "com.triactive.jdo.JdbcTrace".
Each trace option is a boolean that enables or disables logging of a particular kind of activity. The options can be set individually by setter methods or collectively with the setOptions() method.
| Field Summary | |
static java.lang.String |
LOG_CATEGORY
The logging category to which all trace output is sent. |
| Constructor Summary | |
Trace()
Constructs a new trace object. |
|
Trace(java.lang.String options)
Constructs a new trace object configured according to the given options string. |
|
| Method Summary | |
boolean |
getLogExecutionFailures()
When true, any SQL statement whose execution throws a
SQLException is logged at ERROR level. |
boolean |
getLogExecutionTimes()
When true, each SQL statement is logged at INFO level upon
successful execution, along with the execution time in milliseconds. |
boolean |
getLogWarnings()
When true, all SQLWarning objects occurring
on a Connection, Statement, or
ResultSet are logged at WARN level. |
void |
setLogExecutionFailures(boolean logExecutionFailures)
When true, any SQL statement whose execution throws a
SQLException is logged at ERROR level. |
void |
setLogExecutionTimes(boolean logExecutionTimes)
When true, each SQL statement is logged at INFO level upon
successful execution, along with the execution time in milliseconds. |
void |
setLogWarnings(boolean logWarnings)
When true, all SQLWarning objects occurring
on a Connection, Statement, or
ResultSet are logged at WARN level. |
void |
setOptions(java.lang.String options)
Enables the trace options specified in the given string. |
java.sql.Connection |
traceConnection(java.sql.Connection conn)
Places a tracing wrapper around the specified connection. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String LOG_CATEGORY
| Constructor Detail |
public Trace()
public Trace(java.lang.String options)
options - a comma-separated string containing the keywords of the options to
be enabled.| Method Detail |
public void setOptions(java.lang.String options)
Each trace option is enabled by including its keyword.
| Option keyword | Description |
|---|---|
| LogExecutionTimes | Logs every executed SQL statement and its execution time in milliseconds |
| LogExecutionFailures | Logs every SQL statement whose execution throws a SQLException |
| LogWarnings | Logs every SQLWarning produced by a Connection, Statement, or ResultSet |
options - a comma-separated string containing the keywords of the options to
be enabled.public boolean getLogExecutionTimes()
true, each SQL statement is logged at INFO level upon
successful execution, along with the execution time in milliseconds.
true if logging execution timespublic void setLogExecutionTimes(boolean logExecutionTimes)
true, each SQL statement is logged at INFO level upon
successful execution, along with the execution time in milliseconds.
logExecutionTimes - true to log execution timespublic boolean getLogExecutionFailures()
true, any SQL statement whose execution throws a
SQLException is logged at ERROR level.
true if logging execution failurespublic void setLogExecutionFailures(boolean logExecutionFailures)
true, any SQL statement whose execution throws a
SQLException is logged at ERROR level.
logExecutionFailures - true to log execution failurespublic boolean getLogWarnings()
true, all SQLWarning objects occurring
on a Connection, Statement, or
ResultSet are logged at WARN level.
true if logging SQL warningspublic void setLogWarnings(boolean logWarnings)
true, all SQLWarning objects occurring
on a Connection, Statement, or
ResultSet are logged at WARN level.
logWarnings - true to log SQL warningspublic java.sql.Connection traceConnection(java.sql.Connection conn)
conn - the connection to be traced
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||