The show_sql parameter only makes the generated SQL statements to be written to the console, which might not be what you want.
In order to show the SQL statements in a log file, use log4j, and simply add a category that grabs anything from the package org.hibernate.SQL, for example:
Code:
<category name="org.hibernate.SQL" additivity="false">
<priority value="debug" />
<appender-ref ref="appenderConsole" />
<appender-ref ref="appenderFileSQL" />
</category>
you could also create a separate file only for SQL statements, for example:
Code:
<appender name="appenderFileSQL" class="org.apache.log4j.RollingFileAppender">
<param name="File" value="@log.dir@/@log.filename@.sql"/>
<param name="Append" value="true"/>
<param name="MaxFileSize" value="20000KB"/>
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %m%n"/>
</layout>
</appender>
SQL logging belongs to the DEBUG level, but you can log at different levels to different destinations. For example, the rest of your applicationmight log only at "INFO" level, but you can log the SQL code to a different file at DEBUG level.