Diagonostics not logging insert statement when there is sql exception

Posts   
 
    
happyfirst
User
Posts: 215
Joined: 28-Nov-2008
# Posted on: 22-Jun-2012 18:33:16   

3.1,Adapter,SqlServer

I have a view with an instead of trigger. Trying to debug why the save always returns false (even though the records are getting created in the db). I think it's an issue with the identity but can't tell yet.

But I've noticed that when there are no errors in my trigger, the trace listener does log the insert statement, the parameters, etc.

But then, if the database ever throws an exception, nothing gets logged anymore so I can't tell what exactly llbl sent to the database.

Am I doing something wrong?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 22-Jun-2012 21:25:20   
  • We need more info about your scenario. Is it reproducible? Could you make a tiny repro solution (DDL script, LLBLGen file and a repro code)?

  • What is your SQLServer version?

  • Are you setting the Compatibility mode?

  • What does exactly your instead-of-insert trigger?

David Elizondo | LLBLGen Support Team
happyfirst
User
Posts: 215
Joined: 28-Nov-2008
# Posted on: 22-Jun-2012 21:39:46   

Don't worry about the instead of trigger, I should have left that out of the post, anyways I solved that for now.

I just want to know why LLBL doesn't log the sql statements ALWAYS. Seems like if there is ever a database exception, the sql doesn't go to the trace output.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 22-Jun-2012 21:57:53   

Ok. Let me test that and see where exactly is the tracing for that...

David Elizondo | LLBLGen Support Team
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 23-Jun-2012 07:50:30   

The trace info is sent when the query is built, should be able to see the trace if it is set as Verbose in your config.

David Elizondo | LLBLGen Support Team
happyfirst
User
Posts: 215
Joined: 28-Nov-2008
# Posted on: 23-Jun-2012 15:01:11   

Exactly which file and line is the sql logged? I will debug there too then. All I know is if the query succeeds, the sql does get logged, if I get a sql exception, the sql is not logged.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 24-Jun-2012 18:25:38   

RUn the application in Debug mode, and you should see the log in the output window.

happyfirst
User
Posts: 215
Joined: 28-Nov-2008
# Posted on: 26-Jun-2012 01:52:40   

I am in debug mode. Doesn't show up in output window. Everything else basically does. I see the select statement from prior search. Then I try to save a new record. I see all this stuff getting logged about the save, MethodEnter SaveEntityCollection - Start Transaction - persisted entity info, my values are there, opeconnection, executeactionquery, ROLLBACK, RESET.

An exception is thrown.

No sql is logged to text file or output window.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 26-Jun-2012 07:37:16   

Are you on verbose trace mode? :

  <system.diagnostics>
    <switches>
      <add name="SqlServerDQE" value="4" />
      <add name="ORMPersistenceExecution" value="4" />
    </switches>
  </system.diagnostics>

If it doesn't help, please post (or attach it, if it's too long) the complete trace (method enter, method exit, etc...).

David Elizondo | LLBLGen Support Team
happyfirst
User
Posts: 215
Joined: 28-Nov-2008
# Posted on: 28-Jun-2012 16:13:52   

I've tried with everything set to 4. However, lately, I've set ORMStateManagement back to 0

I have created another thread in the help desk with more logging so that you can review. Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 28-Jun-2012 19:28:29   

I'll close this thread so we can follow up in one place.