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

Log4net configSource with Environment Variables

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Trivial
    • Resolution: Unresolved
    • 1.2.15
    • None
    • Other
    • None

    Description

      When separating Log4Net configuration in an external configuration file situated in separated base directory, i tried to specify the path of the file by using Environment variables :

      <log4net configSource="${CONFIG_BASE}\config\log4net.config" />
      where CONFIG_BASE is the key of an environment variable i got the following errors:

      log4net:ERROR Failed to parse config file. Is the <configSections> specified as: <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net, Version=1.2.15.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a" />
      System.Configuration.ConfigurationErrorsException: Unable to open configSource file '${PRODUCT_BASE}\config\Log4Net.config'. (Tests\bin\Debug\MY_PRODUCT.Core.Tests.dll.config line 10)
      at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
      at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
      at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
      at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
      at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
      at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
      at System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String sectionName)
      at System.Configuration.ConfigurationManager.GetSection(String sectionName)
      at log4net.Config.XmlConfigurator.InternalConfigure(ILoggerRepository repository)

      Attachments

        Activity

          People

            Unassigned Unassigned
            cyounes Younes CHEIKH
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: