Health Dashboard - Information - How to activate SQL traces on AAD and RestAPI logs

Purpose

This page contains steps to activate SQL traces on HD and RestAPI logs.

Applicable in CAST Version
Release
Yes/No
8.3.x(tick)
8.2.x(tick)
8.1.x(tick)
8.0.x(tick)
7.3.x(tick)
7.2.x(tick)
7.0.x(error)
Applicable RDBMS
RDBMS
Yes/No
Oracle Server(tick)
Microsoft SQL Server(tick)
CSS2(tick)
CSS1(error)
Details

To activate SQL traces on HD and RestAPI logs in both 7.3.x and versions > 8.0.x, please follow the below steps as per the version of CAST AIP:

For 7.3.x

You need to modify the log4.properties file located at <Tomcat_Installation_dir>\webapps\<HD/RestAPI Application>\WEB-INF\log4.properties with following changes:

log4j.logger.org.springframework.jdbc.core.JdbcTemplate=TRACE, textout
log4j.logger.org.springframework.jdbc.core.StatementCreatorUtils=TRACE, textout

and then restart your application server so that the changes are taken into account.

This log is formed by default in <Tomcat_Installation_dir>\webapps\<HD/RestAPI Application>\logs\HD.log

For versions > 8.0.x

You need to modify the log4j2.xml file located at <Tomcat_Installation_dir>\webapps\<HD/RestAPI Application>\WEB-INF\log4j2.xml with following changes:

<Properties>
		 <Property name="auditLevel">ALL</Property>
</Properties>
 
.....
.....
 
<Logger
name="org.springframework.jdbc.core.JdbcTemplate" level="trace" additivity="false"> <AppenderRef ref="textout"/>
</Logger>

<Logger
name="org.springframework.jdbc.core.StatementCreatorUtils" level="trace" additivity="false"> <AppenderRef ref="textout"/>
</Logger>

and then restart your application server so that the changes are taken into account. Meaning of the values for this property is given below:

OFF -> audit trail is disabled
ALL -> audit trail is enabled
trace → to obtain SQL traces 

This log is formed by default in <Tomcat_Installation_dir>\webapps\<HD/RestAPI Application>\logs\restapi.log.

Notes/comments

Activating the SQL traces may lead to poor performance. Please do this only when needed and change these options back once you have in hand the log with SQL traces.