0

I tried this solution (https://stackoverflow.com/a/3163050/766964) to use two versions of log4net (1.2.10.0 and 1.2.13.0), and it did get me past the File Not Found exception, but then nothing is actually logged.

UPDATE: I got it to log by specifying the full type information:

<!--<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>-->
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" />

But does this work? Because shouldn't it use 1.2.13.0 section handler for that one? Is there a way to specify both handlers and two separate sections with the same name?

Community
  • 1
  • 1
Tomas
  • 125
  • 1
  • 10

1 Answers1

1

I think you can do this but you will have to load the configuration for at least one of the versions in code. This post should help Log4Net - Can I have a custom section name in Config. The reason the binding works is because you are specifying exactly which library to use (version, public key etc). The binding redirects only kick in when the reference in question is ambiguous (ie two versions of the same assembly are found). Here you are specifying exactly which library to use. In answer to your original question, is it possible to specify 2 sections with the same name? No. Is it possible to change the name of one of the sections? Apparently not, according to the link above.

Community
  • 1
  • 1