th3morg th3morg - 4 months ago 43x
Java Question

How do I log SQL Statements in Dropwizard

How do I turn on SQL query logging for a Dropwizard application? I would like it to only log SQL in certain environments.


In your application YAML file add a "logging:" definition like the following:

# Logging settings.

  # The default level of all loggers. Can be OFF, ERROR, WARN, INFO, DEBUG, TRACE, or ALL.
  level: INFO

   # Logger-specific levels.

      # Overrides the levels of certain packages or files.
      "org.skife.jdbi.v2": TRACE