title: How to know/log whether Hibernate 2nd-level cache was used or not for a query?
body: <p>Currently, in order to check if the Hibernate 2nd-level cache was used for a Database query, I check my SQL log (through p6spy or logSql=true in Datasource.groovy) to see if the Grais/Hibernate triggered an SQL query. And I assume that if the query was not logged, it might mean that cache was used. </p>
  
  <p>It is pretty complicated for a simple information, isn't it? </p>
  
  <p>So do you know a simple way to get and log the information : "Cache was used vs. DB query was triggered" ? </p>
  
  <p><strong>EDIT</strong>: Following Pascal recommendations, I have added this <code>trace 'org.hibernate.cache'</code> to my log4j configuration.</p>