Uploaded image for project: 'Couchbase .NET client library'
  1. Couchbase .NET client library
  2. NCBC-2324

Random KeyNotFoundException in LogManagerTests.Test_LogLevel_Debug

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.0.0-beta.4
    • 3.0.0
    • library
    • None
    • 1

    Description

      This test fails periodically at random times:

      X Couchbase.UnitTests.Core.Logging.LogManagerTests.Test_LogLevel_Debug [74ms]
        Error Message:
         System.Collections.Generic.KeyNotFoundException : The given key 'Couchbase.UnitTests.Core.Logging.LogManagerTests.Poco' was not present in the dictionary.
        Stack Trace:
           at System.Collections.Concurrent.ConcurrentDictionary`2.ThrowKeyNotFoundException(Object key)
         at System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key)
         at Couchbase.UnitTests.Core.Logging.LogManagerTests.Test_LogLevel_Debug() in /home/couchbase/jenkins/workspace/dotnet-sdk/couchbase-net-client-scripted-build-pipeline/couchbase-net-client/tests/Couchbase.UnitTests/Core/Logging/LogManagerTests.cs:line 29
      

      Attachments

        Issue Links

          For Gerrit Dashboard: NCBC-2324
          # Subject Branch Project Status CR V

          Activity

            btburnett3 Brant Burnett added a comment - - edited

            This is actually the result of a design flaw in the static LogManager. Any class which collects an ILogger in static initialization will only log correctly if the static initialization runs after the LogManager is configured with a LoggerFactory. Any LoggerFactory set on LogManager after that point won't receive any logs.

            I am working on a gradual redesign of the logging infrastructure over several commits to work via dependency injection rather than static globals. This will resolve the design flaw and eliminate LogManager altogether.

            btburnett3 Brant Burnett added a comment - - edited This is actually the result of a design flaw in the static LogManager. Any class which collects an ILogger in static initialization will only log correctly if the static initialization runs after the LogManager is configured with a LoggerFactory. Any LoggerFactory set on LogManager after that point won't receive any logs. I am working on a gradual redesign of the logging infrastructure over several commits to work via dependency injection rather than static globals. This will resolve the design flaw and eliminate LogManager altogether.

            Fixed by removing the LogManager altogether, all logging is now done via dependency injection rather than statics.

            btburnett3 Brant Burnett added a comment - Fixed by removing the LogManager altogether, all logging is now done via dependency injection rather than statics.

            People

              btburnett3 Brant Burnett
              jmorris Jeff Morris
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes

                  PagerDuty