This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.
SQL Statement Logging¶
The DevCon contains an SQL Logging tab which (if enabled) displays all executed SQL statements and their execution time.
Hibernate provides the option
hibernate.show_sql that logs all statements to the console, however the parameters
are missing and only the
? placeholder is visible.
Therefore we use p6spy to log the complete SQL statements.
spy.properties file has to be created which configures an appender for the SQL statements:
A reference to this file needs to be passed as a command line argument when Nice2 is started:
In addition a custom JDBC Driver (P6SpyDriver) and JDBC url (
jdbc:p6spy:postgresql://...) needs to be used.
This is configured in the HibernatePropertiesBuilder.
The p6spy driver is currently only configured for the
All statements are passed to the configured NiceLogger by the p6spy driver.
To decouple the SQL statement consumers from p6spy the SpyLoggerService acts as a bridge between the logger and the consumers. Consumers can register with the service and receive the SQL statement events. Currently the only consumer is the SqlLoggingSocketFeeder which publishes the statements to the DevCon.