Choosing the right logging configuration can make the difference between finding a performance issue during development or suffering from it in production. But it can also create an overhead that slows down your application. You need to decide which information you need and configure your system accordingly.
I, therefore, prefer to use two different configurations:
- A development configuration that logs enough internal information to understand the database interactions, see the number of executed queries, and check the SQL statements.
- A production configuration that logs as few messages as possible and avoids any overhead.
I explain both configurations in more detail in the following video.
Or if you prefer to read, you can find a detailed description of Hibernate's logging configuration and my recommendations for development and production in the Hibernate Logging Guide on my blog.