log4net XMLConfigurato.Configure 不存在
我正在尝试在我的项目上设置 log4net 日志记录。我认为一切都设置正确,我有对 dll 的引用,并且有它的配置文件。
由于某种原因,当我尝试使用 log4net.Config.XMLConfigurator.Configure() 对其进行配置时,它仅识别对 log4net.Config.XMLConfigurator 的调用。智能感知无法看到 XMLConfigurator 类中的配置方法,当我编译时,它会抛出错误:
错误 40 类、结构或接口成员声明中的无效标记“(”
可能出了什么问题?
I'm trying to set up log4net logging on my project. I think everything is setup correctly, I have the reference to the dll and I've got a config file for it.
For some reason when I try to cofigure it using log4net.Config.XMLConfigurator.Configure() it only recognises the call up to log4net.Config.XMLConfigurator. The intellisense cannot see the Configure method in the XMLConfigurator class and when I compile, it throws an error:
Error 40 Invalid token '(' in class, struct, or interface member declaration
What could be wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们广泛使用 Log4Net,并发现最简单的方法是将配置文件命名为与应用程序可执行文件相同的名称,例如 Myapp.exe.log4net。
然后,您可以在 AssemblyInfo.cs 文件中添加一行来获取此文件
请参阅 http ://logging.apache.org/log4net/release/manual/configuration.html
不要忘记将 .log4net 文件设置为“复制到输出目录”!
We use Log4Net extensively, and have found that the easiest way of doing it is to name the config file the same as the application executable, e.g. Myapp.exe.log4net.
You can then put a line in your AssemblyInfo.cs file to pick up this file
See http://logging.apache.org/log4net/release/manual/configuration.html
Don't forget to set your .log4net file to Copy to output directory!