There are three primary reasons for choosing log4net as our logging framework. First and foremost, it's an incredibly powerful logging framework with open extensibility. Second, it's open source so there is no charge associated with implementing or using it. Last, but not least, it's bundled with NHibernate because NHibernate uses it as its internal logging framework.
More information about log4net can be found at http://logging.apache.org/log4net.
If we are using log4net, we can simply set a few configuration options and access a number of interesting NHibernate internal log operations. One of the most helpful of these operations is the ability to view the SQL statements as they are generated. You can see a sample of this in the following screenshot:
As you can see, having access to this information is really useful. By knowing the SQL that NHibernate is executing, we can take this SQL statement and execute it directly in our SQL tool, such as SSMS, and see EXACTLY what is being...