Hello Ivy-Team,

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?

Thanks for answersalt text

asked 04.12.2015 at 15:42

Florian%20Heinrich's gravatar image

Florian Hein...
616611
accept rate: 0%


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 [designer-root-dir]/configuration/log4jconfig.xml with a text editor.

Add a category to define the hibernate sql log level right below an existing category definition:

  <category name="org.hibernate.SQL" class="ch.ivyteam.log.Logger">
    <priority value="WARN"/><!-- raised priority so that we see the logs with a default designer configuration -->
  </category>

Restart you Designer to apply the changed log configuration.

For a list of available loggers consult the hibernate documentation: https://docs.jboss.org/hibernate/orm/3.3/reference/en-US/html/session-configuration.html#configuration-logging


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: http://developer.axonivy.com/doc/latest/EngineGuideHtml/monitoring.html#d5e4726

link

answered 07.12.2015 at 14:27

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
7.1k11344
accept rate: 70%

edited 07.12.2015 at 14:27

Thank You this works

(09.12.2015 at 10:54) Florian Hein... Florian%20Heinrich's gravatar image

Hello Hapem85,

try to create your own hibernate appender:

<appender name="hibernate-appender" class="org.apache.log4j.RollingFileAppender">
    <param name="Append" value="true"/>
    <param name="File" value="${user.dir}/logs/hibernate.log"/>
    <layout class="org.apache.log4j.PatternLayout">
        <param name="ConversionPattern" value="[%d{dd/MM/yy} %d{HH:mm:ss}] %-5p %c %m%n"/>
    </layout>
</appender>
and change the category to logger:
<logger name="org.hibernate.SQL">
    <appender-ref ref="hibernate-appender"/>
    <level value="DEBUG"/>
</logger>

Hope that helps.

link

answered 10.12.2015 at 14:27

Florian%20Heinrich's gravatar image

Florian Hein...
616611
accept rate: 0%

Thank you very much Florian! It's really helpful!

(11.12.2015 at 04:45) Hap Em Hap%20Em's gravatar image

Hello all,

I have tried with the solution form Reguel but it doesn't work. Pls help me if you have any idea!

Thanks!

In the persistence.xml, I had added the property for show sql:


<property name="hibernate.show_sql" value="true"/>

This is my log4jconfig.xml:

<log4j:configuration debug="false" xmlns:log4j="http://jakarta.apache.org/log4j/">

<appender name="FileLog" class="org.apache.log4j.DailyRollingFileAppender"> <param name="Threshold" value="INFO"/> <param name="File" value="${user.dir}/logs/ch.ivyteam.ivy.log"/> <param name="DatePattern" value="'.'yyyy-MM-dd"/> <layout class="org.apache.log4j.IvyLog4jLayout"> <param name="DateFormat" value="HH:mm:ss.SSS"/> </layout> </appender>


<appender name="ConsoleAppender" class="org.apache.log4j.ConsoleAppender"> <param name="Threshold" value="WARN"/> <layout class="org.apache.log4j.IvyLog4jLayout"> <param name="DateFormat" value="HH:mm:ss.SSS"/> <param name="ContextPrinting" value="false"/> <param name="FixedCategoryLength" value="20"/> <param name="ThreadPrinting" value="false"/> </layout> </appender>

<category name="org.apache.cxf.bus.spring" class="ch.ivyteam.log.Logger"> <priority value="ERROR"/> </category>

<category name="org.hibernate.SQL" class="ch.ivyteam.log.Logger"> <priority value="INFO"/> </category>

<root> <level value="INFO"/> <appender-ref ref="FileLog"/> <appender-ref ref="SmsLog"/> <appender-ref ref="EmailLog"/> <appender-ref ref="ConsoleAppender"/> </root>

</log4j:configuration>

link

answered 10.12.2015 at 13:09

Hap%20Em's gravatar image

Hap Em
3191013
accept rate: 0%

edited 10.12.2015 at 13:11

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×19
×6

Asked: 04.12.2015 at 15:42

Seen: 1,624 times

Last updated: 11.12.2015 at 04:45