Reputation: 19418
I see a lot of logs logging al the queries that make the logs not very useful. I am trying to remove this logging from my dropwizard app logs I tried to do it through the yml file
logging:
level: "DEBUG"
loggers:
org.hibernate: ERROR
And also in the logback.xml
<logger name="org.hibernate">
<level value="ERROR" />
</logger>
I also tried appenders to the yml file as console and syslog. What is the way to remove these SELECT statements from the logs?
I dont want to move the logs to another file as I do want to see the errors
The logger isnt org.hibernate but I only see "Hibernate: select * FROM ....."
Upvotes: 2
Views: 1426
Reputation: 2164
In my case, setting the "hibernate engine" level (in the application.yaml
file) decreased the number of log messages:
loggers:
org.hibernate.engine: error
Upvotes: 0
Reputation: 30997
You have to set hibernate.show_sql
to false
database:
properties:
hibernate.show_sql: false
However, this alone may not work. I upvoted the other answer as it led me to this - you do indeed have to pay attention to your configured logging levels for the hibernate package because surprisingly, if your org.hibernate.SQL
logging level is set to DEBUG
then this will override the hibernate.show_sql: false
config and log the SQL anyway!
You need to make sure it's set to INFO
or greater
logging:
loggers:
"org.hibernate.SQL":
level: INFO
Upvotes: 2
Reputation: 31968
You should try changing your default application logging level to INFO
instead
logging:
level: INFO
and further, modify log level of a package using
# Sets the level for 'org.hibernate' to ERROR
loggers:
org.hibernate: ERROR
Here is an effective example of the usage from dropwizard itself.
Or in your case probably the package contributing to the logs as
loggers:
org.hibernate.SQL: ERROR # note - not moving to another file either
Upvotes: 1