I’m just getting started with log4net. To read the XML configuration file, it is my understanding that you have to place the following in the AssemblyInfo file of your project:
<Assembly: log4net.Config.XmlConfigurator(ConfigFile:="Log4net.Config", Watch:=True)>
I have a solution with several projects, and it seems that I have to put this statement in every AssemblyInfo file in the solution (one for each project). I tried just putting the statement in the Startup project’s AssemblyInfo, but logging calls in other projects won’t work. I have to include the statement in every project that makes logging calls.
1) Is there a way to make the call to Config.XmlConfigurator in one place, one time for an entire solution?
2) What causes the behavior I’m seeing?
Why not to use static constructor in class that will be referenced by all assemblies? If they are in single app domain than it will be called exactly once.