IBM Support

Logging SQL and its parameters to diagnose performance and data integrity issues

Question & Answer


Question

WebSphere Lombardi Edition (WLE) 7.x uses Spring to make its database calls. How do I turn up Spring logging so that I can view the SQL and the parameters passed into that SQL?

Answer

edit process-center/config/log4j.xml (or process-server/config/log4j.xml)

Change:


<category name="org.springframework.jdbc.core.JdbcTemplate" additivity="false">
<priority value="error"/>
<appender-ref ref="TWSqlAppender"/>
</category>

to (notice we change the category name and the priority value):


<category name="org.springframework.jdbc.core" additivity="false">
<priority value="trace"/>
<appender-ref ref="TWSqlAppender"/>
</category>

and change the appender from:

<appender name="TWSqlAppender" class="org.apache.log4j.RollingFileAppender">


<param name="Threshold" value="DEBUG"/>
<param name="File" value="C:/IBM/Lombardi7/process-center/logs/tw-sql.log"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} [%t] %p %c %x - %m\r\n"/>
</layout>
</appender>

to (we change the threshold to trace - your path may vary):

<appender name="TWSqlAppender" class="org.apache.log4j.RollingFileAppender">


<param name="Threshold" value="TRACE"/>
<param name="File" value="C:/IBM/Lombardi7/process-center/logs/tw-sql.log"/>
<param name="MaxBackupIndex" value="10"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ISO8601} [%t] %p %c %x - %m\r\n"/>
</layout>
</appender>


You do not need to restart for the changes to take affect. Now you will have both the sql and its parameters in the tw-sql.log file.

[{"Product":{"code":"SSFPRP","label":"WebSphere Lombardi Edition"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Installation \/ Configuration","Platform":[{"code":"PF002","label":"AIX"},{"code":"PF010","label":"HP-UX"},{"code":"PF016","label":"Linux"},{"code":"PF027","label":"Solaris"},{"code":"PF033","label":"Windows"}],"Version":"7.2;7.1;7.0.1","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Product Synonym

WLE Lombardi

Document Information

Modified date:
15 June 2018

UID

swg21461918