I know we can hide / show sql queries from hibernate.cfg.xml
or persistence.xml
with following code:
<property name="show_sql">true</property>
but is there any way to do same from jBoss configuration files?
I know we can hide / show sql queries from hibernate.cfg.xml
or persistence.xml
with following code:
<property name="show_sql">true</property>
but is there any way to do same from jBoss configuration files?
in Jboss EAP 6.2.
Need to set environment variable by changing standalone.xml
<system-properties>
<property name="org.jboss.as.logging.per-deployment" value="false"/>
</system-properties>
Alternately, you can give it as a JVM option.
$ standalone.sh -Dorg.jboss.as.logging.per-deployment=false
Then in standalone.xml add the following under <subsystem xmlns="urn:jboss:domain:logging:1.3">
element
<logger category="org.hibernate.SQL">
<level name="DEBUG"/>
</logger>
Add these to hibernate.cfg.xml
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="use_sql_comments">true</property>
There are two straightforward configuration that can be done on Wildfly/Jboss standalone.xml to display the queries along with placeholder values-
then adding spy="true"
property to the datasources you wish to get the queries logged for.
You can enable or disable logging of the following categories (using a log4j.properties file here):
log4j.properties
log4j.logger.org.hibernate=INFO, hb
log4j.logger.org.hibernate.SQL=DEBUG
log4j.logger.org.hibernate.type=TRACE
log4j.logger.org.hibernate.hql.ast.AST=info
log4j.logger.org.hibernate.tool.hbm2ddl=warn
log4j.logger.org.hibernate.hql=debug
log4j.logger.org.hibernate.cache=info
log4j.logger.org.hibernate.jdbc=debug
log4j.appender.hb=org.apache.log4j.ConsoleAppender
log4j.appender.hb.layout=org.apache.log4j.PatternLayout
log4j.appender.hb.layout.ConversionPattern=HibernateLog --> %d{HH:mm:ss} %-5p %c - %m%n
log4j.appender.hb.Threshold=TRACE
hibernate.cfg.xml
<property name="show_sql">true</property>
<property name="format_sql">true</property>
<property name="use_sql_comments">true</property>