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

Unable to use default config loading

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.2.10
    • Core
    • None

    Description

      Default config loading from app.config with the Log4NetConfigSectionHandler is not possible, because XmlConfiguratior.Configure(ILoggerRepository repository), where the ConfigurationManager is used, never gets called.

      The DefaultRepositorySelector.ConfigureRepository only loads config when the (Xml)ConfiguratorAttribute is found in the loaded assembly and calls Configure(assembly, repository) on this attribute. When using the XmlConfiguratorAttribute, the XmlConfigurator.Configure(targetRepository, configFile) gets called, which doesn't use the ConfigurationManager but an XmlDocument instead.

      The most annoying thing is that you are required now to use the XmlConfiguratorAttribute on assembly level, because otherwise the configuration is ignored. See DefaultRepositorySelector line 657 for more details. This is a problem when using calling functions in external assemblies, for instance with unit testing, because the logging from the tested object is ignored because the configuration fails to load.

      Attachments

        Activity

          People

            Unassigned Unassigned
            riezebosch Manuel Riezebosch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: