View SQL generated by NHibernate

NHibernate has a built-in mechanism to log all SQL statements generated. It has a configuration parameter “show_sql” which should be set to true. NHibernate will throw all statements to Console.out if this is true. So a console application can easily display all statements but what about the web application?

An easy way is to use the NUnit console which has a separate tab for all Console.out output. If you do not use NUnit work out with log4net.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s