0

I am using spirng mvc with Hibernate. I have like 30 entities mapped, i wanted to see the SQL and when i put these settings in log4j.xml

<logger name="org.hibernate">
    <level value="debug"/>
</logger>

I see unstoppable repeated logs, i am putting some of lines here to show how it is behaving. Can anyone guide what am i doing wrong.

[org.seven.model.User.followers#1], was: [org.seven.model.User.followers#1] (uninitialized)
2020-02-07 11:20:23 DEBUG Collections:201 - Collection found: [org.seven.model.User.following#1], was: [org.seven.model.User.following#1] (uninitialized)
2020-02-07 11:20:23 DEBUG Collections:201 - Collection found
[org.seven.model.User.privileges#1], was: [org.seven.model.User.privileges#1] (uninitialized)
2020-02-07 11:20:23 DEBUG Collections:201 - Collection found
[org.seven.model.User.roles#1], was: [org.seven.model.User.roles#1] (uninitialized)
2020-02-07 11:20:23 DEBUG Collections:201 - Collection found: [org.seven.model.Story.comments#425], was: [org.seven.model.Story.comments#425] (uninitialized)
2020-02-07 11:20:23 DEBUG Collections:201 - Collection found
[org.seven.model.Story.feedbacks#425], was: [org.seven.model.Story.feedbacks#425
(uninitialized)
2020-02-07 11:20:23 DEBUG Collections:201 - Collection found
[org.seven.model.Story.genres#425], was: [org.seven.model.Story.genres#425] (uninitialized)
Haseeb Wali
  • 1,181
  • 3
  • 14
  • 34
  • 1
    What is the question here? You enable DEBUG logging for all of Hibernate. This is going to create a huge amount of logs. No surprise here for me. I you want to log SQL statements and possibly parameters, see https://stackoverflow.com/questions/1710476/how-to-print-a-query-string-with-parameter-values-when-using-hibernate – Jens Schauder Feb 07 '20 at 07:07
  • @JensSchauder If i want to see mySQL do i have to wait for 10-15 minutes to be able to start my application? is there any better solution? – Haseeb Wali Feb 07 '20 at 08:20
  • If you use the correct logging levels ist shouldn't take much for almost all applications. But of course logging costs performance and if you execute many SQL statement anything is possible. – Jens Schauder Feb 07 '20 at 08:32

0 Answers0