Custom SqlStatementLogger

We would like to have a custom way of logging SQL statements and their execution time. Right now SqlStatementLogger seems hard wired into JdbcServicesImpl. What is the best way to achieve this?

In Hibernate we built something that you can use. We use log4j. This is an extract of the configuration file:

The application runs in tomcat 9












You can substitute or delete the environment variables.

Hope this help.
Luca

    
  	<RollingFile name="HibernateSQL" fileName="${env:CATALINA_BASE}/logs/HibernateSQL.log" filePattern="${env:CATALINA_BASE}/logs/HibernateSQL.log.%i.gz">
      <PatternLayout pattern="%d{[dd-MM-YYYY HH:mm:ss,SSS]}{${env:LEITFELD_TZ:-UTC}} [%t] %-5p %c{4} - %m%n"/>
      <Policies>
				<SizeBasedTriggeringPolicy size="${env:LEITFELD_FILE_SIZE:-5MB}"/> <!-- Every 5 MB -->
	  </Policies>
	  <DefaultRolloverStrategy max="${env:LEITFELD_FILE_NUMBER:-5}" fileIndex="min" />
  	</RollingFile>
  	<Logger name="org.hibernate.SQL"  level="${env:LEITFELD_SQL_LOG_LEVEL:-WARN}">
      <AppenderRef ref="HibernateSQL"/>
    </Logger>

That would work but that seems like a hack.