How do I log SQL Statements in Dropwizard
Are you using jdbi?, if so, this is working for me:
Set a logger when you create the DBI instance:
DBI dbi = new DBI(dataSource);
dbi.setSQLLog(new SLF4JLog());
Add this configuration to your config file:
logging:
level: INFO
loggers:
"org.skife": TRACE
I guess this idea should be also valid for Hibernate or any other DB access framework.
In your application YAML file add a "logging:" definition like the following:
# Logging settings.
logging:
# The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL.
level: INFO
# Logger-specific levels.
loggers:
# Overrides the levels of certain packages or files.
"org.skife.jdbi.v2": TRACE