Search code examples
javasqldatabaseloggingdropwizard

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.


Solution

  • 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