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

Matthew Lefoster commented on LOG4NET-551:
------------------------------------------

Joe, You were ultimately right. I went down the call stack and found a logging 
call in at least one of the instances where the warning showed up. (A class we 
had to redact the log had to check the configuration settings for redaction 
parameters, and checking the configuration framework caused logging calls...) 
It's still odd to me that the behavior changed depending on how exactly I 
stepped through with the debugger, but it's irrelevant now, because that PR 
made the issue disappear!

Thank you very much for your help. Since this'll be fixed presumably in the 
next version, I'll go ahead and mark this issue resolved.

> LockRecursionException when using File Appenders
> ------------------------------------------------
>
>                 Key: LOG4NET-551
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-551
>             Project: Log4net
>          Issue Type: Bug
>    Affects Versions: 2.0.7
>            Reporter: Matthew Lefoster
>            Priority: Minor
>
> I have been getting the following exception on the console:
> {quote}
> log4net:ERROR Exception while logging
> System.Threading.LockRecursionException: Recursive read lock acquisitions not 
> allowed in this mode.
>    at 
> System.Threading.ReaderWriterLockSlim.TryEnterReadLockCore(TimeoutTracker 
> timeout)
>    at System.Threading.ReaderWriterLockSlim.TryEnterReadLock(TimeoutTracker 
> timeout)
>    at System.Threading.ReaderWriterLockSlim.EnterReadLock()
>    at log4net.Util.ReaderWriterLock.AcquireReaderLock()
>    at log4net.Repository.Hierarchy.Logger.CallAppenders(LoggingEvent 
> loggingEvent)
>    at log4net.Repository.Hierarchy.Logger.ForcedLog(Type 
> callerStackBoundaryDeclaringType, Level level, Object message, Exception 
> exception)
>    at log4net.Repository.Hierarchy.Logger.Log(Type 
> callerStackBoundaryDeclaringType, Level level, Object message, Exception 
> exception)
> {quote}
> I have a number of different appenders, but this only happens when I am using 
> `log4net.Appender.FileAppender`.
> Using a debugger, I was able to narrow it down to this line (I replaced curly 
> brackets with square brackets because otherwise JIRA interprets them as 
> macros):
> {quote}
> Logger.DebugFormat("[1] Executing SQL: [0][2][0]With parameters: [3]",
>                 Environment.NewLine, methodName, sql, new 
> ToStringWrapper(parameters));
> {quote}
> My first thought was that ToStringWrapper() was throwing an exception or 
> generating another logging call. But If I put breakpoints at the log call and 
> at the first line of ToStringWrapper.ToString, the exception will show up in 
> the console between those two points.
> Oddly enough, if I "step into" the logging call instead of just "continuing" 
> and letting the breakpoints handle it, no exception happens.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to