0 Replies Latest reply on Aug 8, 2006 5:59 AM by Aitor Menta Segura

    Hibernate logging facilities

    Aitor Menta Segura Newbie

      Hi all!

      I'm using EJB 3.0 with hibernate and I'd like to log all the SQL queries that are performed by Hibernate. I've changed the log4j.xml to get the queries with the following code


      <category name="org.hibernate">
       <priority value="DEBUG"/>
       </category>
      
      
       <!-- Log SQL statements-->
       <category name="org.hibernate.SQL">
       <priority value="DEBUG"/>
       </category>
      
       <!-- Log the values assigned to the SQL parameters and results -->
       <category name="org.hibernate.type">
       <priority value="DEBUG"/>
       </category>
      
       <!-- print EJBQL and parameters -->
       <category name="org.hibernate.impl.SessionImpl">
       <priority value="debug"/>
       </category>
      
       <category name="org.hibernate.engine.QueryParameters">
       <priority value="debug" />
       </category>
      



      In the server.log I could read several messages like this one:
      2006-08-08 11:26:29,203 DEBUG [org.hibernate.SQL] insert into TRABAJOLABORATORIO (TECNICOLABORATORIO, FECHAESTADO, DESCRIPCION, FECHAPREVENTPIEZA, EST
      ADOPIEZA, IDPRODUCTO, IDEVOLUCIONDISENYOACEPTADA, IDPRIMERAEVOLUCION, TIPOPIEZA, IDLINEASOLICITUDSERIE, IDTRABAJO) values (?, ?, ?, ?, ?, ?, ?, ?, ?,
      ?, ?)


      and previously some assignations to the parameters of the entities but what i'd like to get is not the ? but the real values of the SQL query.

      Could you help me?

      Sorry for my English