title: Logging NHibernate SQL queries
body: <p>Is there a way to access the full SQL query, including the values, inside my code? </p>
  
  <p>I am able to log SQL queries using log4net:</p>
  
  <pre><code>&lt;logger name="NHibernate.SQL" additivity="false"&gt;
      &lt;level value="ALL"/&gt;
      &lt;appender-ref ref="NHibernateSQLFileLog"/&gt;
  &lt;/logger&gt;
  </code></pre>
  
  <p>However, I would like to find a way to log SQL queries from the code also.  This way I will log the specific SQL query that causes an exception in my try/catch statement.</p>
  
  <p>Right now I have to data-mine the SQLFileLog to find the query that caused the exception when an exception occurs and it is not efficient.</p>