0

I have seen the following way to include an external log4net config file or app.config in an ASP.NET :

[assembly: log4net.Config.XmlConfigurator(Watch = true)]

My question is : Is this line of code is responsible for triggering of creation of all referenced Appenders files? Is there any other way to refer app.config while using log4net for creating logs ?

Problem : There are two appenders to be used in two different files respectively but when any one file is getting called, two log files are getting generated for both appenders which is not required. One file call should generate one log file based on appender name object.

Reference question : How to create different log files for different classes in one application

Community
  • 1
  • 1
  • Yes, and you can also use `XmlConfigurator.ConfigureAndWatch();` but that won't solve your problem. – stuartd Mar 16 '17 at 12:28
  • @stuartd, what can be done ? – Ushma Mulwani Mar 16 '17 at 14:03
  • If the file really bothers you that much, you can write code to delete it in your app after the configuration has beel loaded. See [this question](http://stackoverflow.com/questions/1343749/get-log4net-log-file-in-c-sharp) for how to get the path. – stuartd Mar 16 '17 at 14:09

0 Answers0