log4net not working

后端 未结 13 1711
轮回少年
轮回少年 2020-12-07 08:04

Hey I have this configuration in my web.config


    

        
13条回答
  •  难免孤独
    2020-12-07 09:04

    I guess that either log4net is not logging at all, or the file is not ending up where you expect it.

    Firstly, have you actually called

    XmlConfigurator.Configure()
    

    anywhere in your code? If the xml snippet above is in the application configuration file, this call will do the trick. If the xml snippet is in it's own file, you'll need to use the .Configure(string) overload that takes the path to the file. Without this call (or apparently the assembly level attribute mentioned by Kirk Woll), then log4net won't be logging at all.

    If you believe this is all done, and log4net should be logging, then maybe you should put a fully qualified path in for the log file while you debug further. That will let you be sure where the file should be.

提交回复
热议问题