<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Hibernate show_sql</title><link>https://answers.axonivy.com/questions/1585/hibernate-show_sql</link><description>&lt;p&gt;Hello Ivy-Team,&lt;/p&gt;
&lt;p&gt;how can I configurate the hibernate.show_sql property?
I tried to configurate it in the persistence configuration editor but nothing happened.
Is there something else I have to do?&lt;/p&gt;
&lt;p&gt;Thanks for answers&lt;img alt="alt text" src="http://answers.axonivy.com/upfiles/Unbenannt_FWwrALz.png"&gt;&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/1585/hibernate-show_sql" rel="self"></atom:link><language>en</language><lastBuildDate>Fri, 11 Dec 2015 04:45:09 -0500</lastBuildDate><item><title>Comment by Hap Em on Florian Heinrich's answer</title><link>https://answers.axonivy.com/questions/1585/hibernate-show_sql#1591</link><description>&lt;p&gt;Thank you very much Florian!
It's really helpful!&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hap Em</dc:creator><pubDate>Fri, 11 Dec 2015 04:45:09 -0500</pubDate><guid>https://answers.axonivy.com/questions/1585/hibernate-show_sql#1591</guid></item><item><title>Answer by Florian Heinrich</title><link>https://answers.axonivy.com/questions/1585/hibernate-show_sql/1590</link><description>&lt;p&gt;Hello Hapem85,&lt;/p&gt;
&lt;p&gt;try to create your own hibernate appender:
&lt;/p&gt;&lt;pre&gt;&amp;lt;appender name="hibernate-appender" class="org.apache.log4j.RollingFileAppender"&amp;gt;
    &amp;lt;param name="Append" value="true"/&amp;gt;
    &amp;lt;param name="File" value="${user.dir}/logs/hibernate.log"/&amp;gt;
    &amp;lt;layout class="org.apache.log4j.PatternLayout"&amp;gt;
        &amp;lt;param name="ConversionPattern" value="[%d{dd/MM/yy} %d{HH:mm:ss}] %-5p %c %m%n"/&amp;gt;
    &amp;lt;/layout&amp;gt;
&amp;lt;/appender&amp;gt;
&lt;/pre&gt;
and change the category to logger:
&lt;pre&gt;&amp;lt;logger name="org.hibernate.SQL"&amp;gt;
    &amp;lt;appender-ref ref="hibernate-appender"/&amp;gt;
    &amp;lt;level value="DEBUG"/&amp;gt;
&amp;lt;/logger&amp;gt;
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hope that helps.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Florian Heinrich</dc:creator><pubDate>Thu, 10 Dec 2015 14:27:50 -0500</pubDate><guid>https://answers.axonivy.com/questions/1585/hibernate-show_sql/1590</guid></item><item><title>Answer by Hap Em</title><link>https://answers.axonivy.com/questions/1585/hibernate-show_sql/1589</link><description>&lt;p&gt;Hello all,&lt;/p&gt;
&lt;p&gt;I have tried with the solution form Reguel but it doesn't work.
Pls help me if you have any idea!&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;In the persistence.xml, I had added the property for show sql:
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
&amp;lt;property name="hibernate.show_sql" value="true"/&amp;gt;
&lt;/code&gt;
&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is my log4jconfig.xml:
&lt;/p&gt;&lt;pre&gt;&lt;code&gt;&lt;p&gt;&lt;/p&gt;





&lt;p&gt;&amp;lt;log4j:configuration debug="false" xmlns:log4j="http://jakarta.apache.org/log4j/"&amp;gt;&lt;/p&gt;
&lt;p&gt; 
  &amp;lt;appender name="FileLog" class="org.apache.log4j.DailyRollingFileAppender"&amp;gt;
    &amp;lt;param name="Threshold" value="INFO"/&amp;gt;
    &amp;lt;param name="File" value="${user.dir}/logs/ch.ivyteam.ivy.log"/&amp;gt;
    &amp;lt;param name="DatePattern" value="'.'yyyy-MM-dd"/&amp;gt;
    &amp;lt;layout class="org.apache.log4j.IvyLog4jLayout"&amp;gt;
      &amp;lt;param name="DateFormat" value="HH:mm:ss.SSS"/&amp;gt;
    &amp;lt;/layout&amp;gt;
  &amp;lt;/appender&amp;gt;&lt;/p&gt;
&lt;p&gt;&lt;br&gt;
  &amp;lt;appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender"&amp;gt;
    &amp;lt;param name="Threshold" value="WARN"/&amp;gt;
    &amp;lt;layout class="org.apache.log4j.IvyLog4jLayout"&amp;gt;
      &amp;lt;param name="DateFormat" value="HH:mm:ss.SSS"/&amp;gt;
      &amp;lt;param name="ContextPrinting" value="false"/&amp;gt;
      &amp;lt;param name="FixedCategoryLength" value="20"/&amp;gt;
      &amp;lt;param name="ThreadPrinting" value="false"/&amp;gt;
    &amp;lt;/layout&amp;gt;
  &amp;lt;/appender&amp;gt;&lt;/p&gt;
&lt;p&gt;
  &amp;lt;category name="org.apache.cxf.bus.spring" class="ch.ivyteam.log.Logger"&amp;gt;
    &amp;lt;priority value="ERROR"/&amp;gt;
  &amp;lt;/category&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;category name="org.hibernate.SQL" class="ch.ivyteam.log.Logger"&amp;gt;
    &amp;lt;priority value="INFO"/&amp;gt;
  &amp;lt;/category&amp;gt;&lt;/p&gt;
&lt;p&gt;
  &lt;/p&gt;
&lt;p&gt;
   &amp;lt;root&amp;gt; 
    &amp;lt;level value="INFO"/&amp;gt;
    &amp;lt;appender-ref ref="FileLog"/&amp;gt;
    &amp;lt;appender-ref ref="SmsLog"/&amp;gt; 
    &amp;lt;appender-ref ref="EmailLog"/&amp;gt; 
    &amp;lt;appender-ref ref="ConsoleAppender"/&amp;gt;
  &amp;lt;/root&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;lt;/log4j:configuration&amp;gt;&lt;/p&gt;
&lt;/code&gt;&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;/p&gt;&lt;/pre&gt;&lt;p&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Hap Em</dc:creator><pubDate>Thu, 10 Dec 2015 13:09:43 -0500</pubDate><guid>https://answers.axonivy.com/questions/1585/hibernate-show_sql/1589</guid></item><item><title>Comment by Florian Heinrich on Reguel Wermelinger's answer</title><link>https://answers.axonivy.com/questions/1585/hibernate-show_sql#1588</link><description>&lt;p&gt;Thank You this works&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Florian Heinrich</dc:creator><pubDate>Wed, 09 Dec 2015 10:54:01 -0500</pubDate><guid>https://answers.axonivy.com/questions/1585/hibernate-show_sql#1588</guid></item><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/1585/hibernate-show_sql/1586</link><description>&lt;p&gt;I guess that you have to customize the log4j configuration so that the hibernate logs are visible in the designer log. To do so open the file &lt;code&gt;[designer-root-dir]/configuration/log4jconfig.xml&lt;/code&gt; with a text editor.&lt;/p&gt;
&lt;p&gt;Add a category to define the hibernate sql log level right below an existing category definition:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  &amp;lt;category name="org.hibernate.SQL" class="ch.ivyteam.log.Logger"&amp;gt;
    &amp;lt;priority value="WARN"/&amp;gt;&amp;lt;!-- raised priority so that we see the logs with a default designer configuration --&amp;gt;
  &amp;lt;/category&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Restart you Designer to apply the changed log configuration.&lt;/p&gt;
&lt;p&gt;For a list of available loggers consult the hibernate documentation:
&lt;a href="https://docs.jboss.org/hibernate/orm/3.3/reference/en-US/html/session-configuration.html#configuration-logging"&gt;https://docs.jboss.org/hibernate/orm/3.3/reference/en-US/html/session-configuration.html#configuration-logging&lt;/a&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Notice that with the Axon.ivy Visual VM plugin you can also inspect the sql queries that are fired by the hibernate persistence layer. In contrast to the normal log outputs you will also see execution times and the used runtime parameters on for parameterized queries.
See the "external database" tab in the plugin: &lt;a href="http://developer.axonivy.com/doc/latest/EngineGuideHtml/monitoring.html#d5e4726"&gt;http://developer.axonivy.com/doc/latest/EngineGuideHtml/monitoring.html#d5e4726&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Mon, 07 Dec 2015 14:27:15 -0500</pubDate><guid>https://answers.axonivy.com/questions/1585/hibernate-show_sql/1586</guid></item></channel></rss>