dieselpoint / norm

Access a database in one line of code.
Other
205 stars 36 forks source link

Statement logging #48

Open robig opened 4 years ago

robig commented 4 years ago

What is the recommended way to get Norm log all of the sql statements? I could not access the relevant parts in Query class to add a reliably logging. We are using log4j as backend, but also having an own Logger providing more logging options for writing nice html logs. But at least a log to log4j debug is required.

Thanks

ccleve commented 4 years ago

Two choices:

  1. Use a JDBC proxy: https://vladmihalcea.com/the-best-way-to-log-jdbc-statements/

  2. Modify norm source. It should be pretty easy. I would insert a logging statement in two places, in Query.execute() just above state.executeUpdate(), and in the Query.results() method, just above state.executeQuery().