Uploaded image for project: 'iBatis for .NET'
  1. iBatis for .NET
  2. IBATISNET-145

Make NoOpLoggerFA the default logger when logging config is missing or malformed. Allow FactoryAdapter to be set by the application

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • DataMapper 1.3
    • DataMapper 1.5
    • None
    • None

    Description

      I'm working on a project that uses 200 statements across 4 SqlMapper instances. Starting the program with DEBUG logging turned on generates about 62k of initialization log messages. Using Log4Net this takes about 1.4 seconds. Using the NoOpLogger it takes about 1.2 seconds.

      When the logging section is missing from the App.config file (or well-formed but missing the IBatisNet.Logging.Log4Net assembly) the application defaults to the ConsoleLogger and the application takes over 15 seconds to initialize itself. The application is a .NET 1.1 WinForm.

      If there isn't a logger defined, I think the default behavior should be to use the NoOpLogger instead of the ConsoleLogger. Perhaps we can add an additional property to the LogManager called Implementation (inspired by Sooda.Logging.LogManager) or FactoryAdapter so the implementation can be specified by the application:

      if (isWinForm)
      {
      if (LogManager.FactoryAdapter is ConsoleOutLoggerFA)

      { // WinForms don't usually redirect the Console.Out...the logging config is probably missing or misconfigured LogManager.FactoryAdapter = new NoOpLoggerFA(); }

      }

      Attachments

        Activity

          People

            gilles Gilles Bayon
            ron liu ron
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: