sqlnhibernateshow-sql

NHibernate not outputting SQL to console


I have configured NHibernate to output the SQL it generates to the console. I have added the following to the app.config of the DLL containing the integration tests I want to run from NUnit:

  <configSections>
    <section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  </configSections>
  <nhibernate>
    <add key="hibernate.connection.provider" value="NHibernate.Connection.DriverConnectionProvider" />
    <add key="hibernate.show_sql" value="true" />
  </nhibernate>

However, the SQL is still not being output to Console.Out. Can anyone think of another setting I might need to set to view the SQL resulting from my NHibernate queries?


Solution

  • Did you try using a sepparate xml config? http://nhibernate.info/doc/howto/various/configure-log4net-for-use-with-nhibernate.html