Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-550

Logging recursively from an Appender not supported for NET_4_0 and MONO_4_0

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.7
    • Fix Version/s: 2.0.8
    • Component/s: Core
    • Labels:
      None

      Description

      When NET_4_0 or MONO_4_0 is defined, log4net uses a ReaderWriterLockSlim with LockRecursionPolicy.NoRecursion. As a result, any attempt to log recursively from within an Appender fail: a System.Threading.LockRecursionException is thrown and swallowed by the log4net Core.

      Other versions use a ReaderWriterLock and allow recursion.

      The following branch adds a unit test that shows this inconsistent behaviour. The test fails for NET_4_0 or MONO_4_0 and passes for other versions:

      https://github.com/JJoe2/log4net/tree/RecursiveLogging

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user JJoe2 opened a pull request:

          https://github.com/apache/log4net/pull/41

          Recursive logging

          Fixes LOG4NET-550

          This fix will be needed to implement logging from the AsyncAppender I am working on.

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/JJoe2/log4net RecursiveLogging

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/log4net/pull/41.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #41


          commit ba250994011db8406b1965ff0bd71dfff7f5b771
          Author: JJoe2 <jocularjoe@hotmail.com>
          Date: 2017-02-01T12:15:44Z

          Unit test to show that recursive logging from an Appender fails (LockRecursionException thrown and swallowed by log4net core) if NET_4_0 or MONO_4_0 is defined.

          commit 54048581c2ce7e0c3a5a5143a66dbee8af8e6eca
          Author: JJoe2 <jocularjoe@hotmail.com>
          Date: 2017-02-01T12:19:54Z

          Fixed LOG4NET-550


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user JJoe2 opened a pull request: https://github.com/apache/log4net/pull/41 Recursive logging Fixes LOG4NET-550 This fix will be needed to implement logging from the AsyncAppender I am working on. You can merge this pull request into a Git repository by running: $ git pull https://github.com/JJoe2/log4net RecursiveLogging Alternatively you can review and apply these changes as the patch at: https://github.com/apache/log4net/pull/41.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #41 commit ba250994011db8406b1965ff0bd71dfff7f5b771 Author: JJoe2 <jocularjoe@hotmail.com> Date: 2017-02-01T12:15:44Z Unit test to show that recursive logging from an Appender fails (LockRecursionException thrown and swallowed by log4net core) if NET_4_0 or MONO_4_0 is defined. commit 54048581c2ce7e0c3a5a5143a66dbee8af8e6eca Author: JJoe2 <jocularjoe@hotmail.com> Date: 2017-02-01T12:19:54Z Fixed LOG4NET-550
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/log4net/pull/41

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/log4net/pull/41
          Hide
          bodewig Stefan Bodewig added a comment -

          merged the PR, many thanks!

          Show
          bodewig Stefan Bodewig added a comment - merged the PR, many thanks!

            People

            • Assignee:
              Unassigned
              Reporter:
              JoeJoe Joe
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development