JDBC_MONITOR_ENABLED parameter
JDBC Monitor (Java Database Connectivity) is a debugging tool that allows you to examine SQLs that are executed in any application for performance and troubleshooting purposes. This document provides the installation steps for JDBC Monitor.
About this task
- Enable the Java agent.
- Enable appropiate trace level for logging to startup.
Procedure
-
Enable the Java agent.
Note: The Java agent can also be enabled in the helm chart.
- Add the JDBC_MONITOR_ENABLED environment variable to the
deployment.
- env: name: JDBC_MONITOR_ENABLED value: "true"
- Or define the entry in
Vault:
${VAULT_URL}/${TENANT}/${ENVIRONMENT}/${ENVTYPE}/jdbcMonitorEnable/ts-app value: true
- Add the JDBC_MONITOR_ENABLED environment variable to the
deployment.
-
Use the logger to enable the JDBC Monitor.
- The JDBC Monitor is controlled with a
logger:
com.hcl.commerce.monitor.jdbc.JDBCMonitor=level
- fine: Query text and execution time
- finer: fine + parameter marker values
- finest: finer + java stack
- To log during startup, use the TRACE_SPEC environment
variable:
- env: name: TRACE_SPEC value: com.hcl.commerce.monitor.jdbc.JDBCMonitor=fine
- Or the corresponding Vault
entry:
${VAULT_URL}/${TENANT}/${ENVIRONMENT}/${ENVTYPE}/traceSpecification/ts-app
- In runtime, the
set-dynamic-trace-specification
run-engine command can be used:run set-dynamic-trace-specification com.hcl.commerce.monitor.jdbc.JDBCMonitor=fine << reproduce the issue >> run set-dynamic-trace-specification *=info
- The JDBC Monitor is controlled with a
logger:
Example
- Fine
[7/8/21 16:06:13:860 GMT] 000000eb JDBCMonitor 1 com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement executeQuery "WSJdbcPreparedStatement executeQuery": { "durationMs":0.77,"query":"SELECT T1.ORDIADJUST_ID, T1.ORDADJUST_ID, T1.ORDERITEMS_ID, T1.AMOUNT, T1.OPTCOUNTER FROM ORDIADJUST T1 WHERE (T1.ORDERITEMS_ID = ?)"}
- Finer
[7/8/21 16:07:21:488 GMT] 000000eb JDBCMonitor 2 com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement executeQuery "WSJdbcPreparedStatement executeQuery":{ "durationMs":0.63,"query":"select NAME,VALUE,TYPE from ORDITEMEXTATTR where ORDERITEMS_ID=? ","parameters": {"1":"15007"}
- Finest
[7/8/21 16:09:00:360 GMT] 00000103 JDBCMonitor 3 com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement executeQuery "WSJdbcPreparedStatement executeQuery":{ "durationMs":1.18,"query":"select PX_RWDOPTION_ID, PX_PROMOTION_ID,ORDERS_ID, RWDCHOICE, RWDSPEC, OPTCOUNTER from PX_RWDOPTION where ORDERS_ID=? ORDER BY PX_RWDOPTION_ID","parameters":" {"1":"4023252"} ","stack":"["java.lang.Thread.getStackTrace(Thread.java:1164)","com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement.executeQuery(WSJdbcPreparedStatement.java:778)","com.ibm.commerce.base.helpers.BaseJDBCHelper.executeQuery(BaseJDBCHelper.java:408)..."