Note that there are some explanatory texts on larger screens.

plurals
  1. POnHibernate SQL logging + stack trace together
    primarykey
    data
    text
    <p>I'm having an issue in where records occasionally go missing from our production database. This is a .NET MVC 2 app with nHibernate. It has been worked on by several developers over the last few years so we assume somewhere a mapping was set-up incorrectly and that nHibernate believes it should be deleting these records.</p> <p>I used log4net to log all SQL generated by nHibernate from both our admin and front-end (in seperate files). Oddly enough it seems the front-end of our site occasionally generates the DELETES for the then missing records. It's odd because although the front-end and back-end share the same data model the front-end shouldn't have any write/update functionality. We were sure it was a bug in admin where all the CRUD is. Yet there it is in the logs... a batch of DELETES.</p> <p>I would like to get more information about where in the stack these SQL statements are being generated from. If I could somehow get a small stack trace before every nHibernate transaction that would be great. So far my log4net settings look like this:</p> <p></p> <pre><code>&lt;appender name="RollingFile" type="log4net.Appender.RollingFileAppender,log4net" &gt; &lt;param name="File" value="nHibernate.txt" /&gt; &lt;param name="AppendToFile" value="true" /&gt; &lt;param name="DatePattern" value="yyyy.MM.dd" /&gt; &lt;layout type="log4net.Layout.PatternLayout,log4net"&gt; &lt;conversionPattern value="%d %p %m%n" /&gt; &lt;/layout&gt; &lt;/appender&gt; &lt;logger name="NHibernate.SQL" additivity="false"&gt; &lt;level value="DEBUG" /&gt; &lt;appender-ref ref="RollingFile" /&gt; &lt;/logger&gt; </code></pre> <p></p> <p>Maybe I just need to log the two things separately and compare the times myself? I'm just looking for a suggestion.</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload