Can you configure log4net in code instead of using a config file?

后端 未结 6 1233
日久生厌
日久生厌 2020-11-28 01:20

I understand why log4net uses app.config files for setting up logging - so you can easily change how information is logged without needing to recompile your cod

6条回答
  •  佛祖请我去吃肉
    2020-11-28 01:40

    Yes, you can configure log4net by calling:

    log4net.Config.XmlConfigurator.Configure(XmlElement element)
    

    See the log4net documentation.

提交回复
热议问题