如何查看NHibernate中生成的SQL
1. 在NHibernate的配置文件中加上
2. 在Log4Net中的配置文件中加上
<level value="WARN"/>
<appender-ref ref="RollingLogFileAppender" />
</logger>
<logger name="NHibernate.SQL">
<level value="ALL"/>
<appender-ref ref="RollingLogFileAppender" />
</logger>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="UserData\log\log.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<staticLogFileName value="false" />
<maximumFileSize value="2MB" />
<layout type="log4net.Layout.PatternLayout">
<header value="[Header]
" />
<footer value="[Footer]
" />
<conversionPattern value="%date %-5level %logger - %message%newline" />
</layout>
</appender>