Hi All,
I've actually found a way of manipulating Hibernate logging from the pom.xml
and/or profiles.xml
The key is to define the logging properties in your hibernate.cfg.xml file
using placeholders and Appfuse will automagically
substitute in values you have defined in your pom/profile.
To be specific:
Define the following default values in your pom (ie switch off SQL logging by
default):
<properties>
<..>
<hibernate.show.sql>false</hibernate.show.sql>
<hibernate.format.sql>false</hibernate.format.sql>
<..>
</properties>
Then in the appropriate profile (eg dev and/or test profiles), turn them on:
<properties>
<..>
<hibernate.show.sql>true</hibernate.show.sql>
<hibernate.format.sql>true</hibernate.format.sql>
<..>
</properties>
And to make them actually work, simply put the following into your
hibernate.cfg.xml file:
<session-factory>
<property name="hibernate.show_sql">${hibernate.show.sql}</property>
<property name="format_sql">${hibernate.format.sql}</property>
<mapping package="....etc..." />
</session-factory>
Oh, and finally, don't be seduced by the attractive sounding "use_sql_comments"
property in your hibernate.cfg.xml, I
have found that it does something weird to the login process so you can't
actually log in to an appfuse app with it switched
on. If you're curious, try putting this in your hibernate.cfg.xml:
<session-factory>
<-- etc -->
<property name="use_sql_comments">true</property>
<-- etc -->
</session-factory>
Cheers,
Rob Hills
Waikiki, Western Australia
Mobile +61 (412) 904-357
Fax: +61 (8) 9529-2137
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]