How do I configure log4net so that log.IsDebugEnabled is true?

后端 未结 6 476
伪装坚强ぢ
伪装坚强ぢ 2020-12-29 02:51

I am trying to use log4net in an ASP.NET application with Visual Studio 2005. I have declared an instance of the logger like so:

Private Shared ReadOnly log          


        
6条回答
  •  情话喂你
    2020-12-29 03:33

    Yes, do it like Anson said. Also, if you are calling Configure in a class library you can do that by adding an attribute to your class:

    [assembly: XmlConfigurator(Watch = true)]
    

    and if you're using log4net.config file, use it like that instead:

    [assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
    

提交回复
热议问题