A few weeks ago, I worked on a bug in the Adyen integration of uCommerce. Sadly, the problem wasn't reliably reproducible. After some time I came up with the theory, that this must be a problem with the multiple requests, that are send by Adyen. It looked like the requests are processed simultaneously and one of them overwrites the changes of the other one.

At first I tried adding more log entries. But that doesn't work out well. A good way to check my theory would be to check the executed SQL. Luckly, uCommerce uses NHibernate.

How do I see the SQL executed by NHibernate?

Just like a good developer does, I asked Google how to do that. And there are a lot of suggestions. Ask me how I know. Some of them suggest to write an interceptor. Others recommend to change the show_sql property in the NHibernate configuration file.

Don't get me wrong. All of them might work in a "regular" NHibernate project. But I am using uCommerce. And I just could not find the hibernate.cfg file to adjust the property.

Long story short...

It's really simple to show the executed SQL in the uCommerce log file. I just adjusted the log level of the NHibernate.SQL logger to DEBUG. As I am using Sitecore in this project, it's done with a short and simple config file:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/">
      <logger name="NHibernate.SQL">
        <level set:value="DEBUG" />

Yes. It's that easy!