[ 
https://issues.apache.org/jira/browse/LOG4NET-461?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14984375#comment-14984375
 ] 

Dominik Psenner commented on LOG4NET-461:
-----------------------------------------

While fixing this I noticed that we might want to refactor this appender 
further such that it opens and closes database connections in SendBuffer(). If 
people want that a connection is not actually closed, they can still use 
connection pools which almost any database driver of today has built in and can 
be specified in the connection string. This is further backed up by the fact 
that newer .NET framework versions provide automatic reconnections and this 
results in the fact that the "ConnectionState" on a connection never reports 
that the connection is actually broken. This further causes the appender to be 
unable to detect broken connections while at the same time reporting that 
queries fail while the actual problem is a lost connection. On top of that the 
overall logic and householding can be simplified.

Please discuss!

> adonetappender 
> ---------------
>
>                 Key: LOG4NET-461
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-461
>             Project: Log4net
>          Issue Type: Bug
>          Components: Appenders
>    Affects Versions: 1.2.11
>            Reporter: Kelly Elton
>            Assignee: Dominik Psenner
>            Priority: Critical
>
> Basically what happens is you guys store the SqlCommand between all requests. 
> The problem is, sometimes this prepared statement gets removed from the cache 
> in SqlServer. When this happens all subsequent requests result in an error 
> "Could not find prepared statement with handle -1"
> You could resolve this by checking for that specific error on submitting and 
> if you get it recreate the command and try again, or just recreate and 
> prepare the statement every time.
> This is a pretty major issue.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to