log4net配置问题
我有一个单独的 Log4Net.config 文件。我添加
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)]
到 AssemblyInfo.cs
当我以调试模式运行应用程序时,lognet 正在记录日志。当我将应用程序发布到 IIS 时,lognet 不会记录任何内容。
我也有以下问题:
BasicConfigurator.Configure(); // in a method
private static readonly ILog _logger = LogManager.GetLogger(typeof(_Default)); // for the instance
这是什么原因?
I have a seperate Log4Net.config file. I added
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)]
to AssemblyInfo.cs
When I run the application with debug mode, lognet is logging. When i publish the application to IIS, lognet is not logging anything.
I have the followings also :
BasicConfigurator.Configure(); // in a method
private static readonly ILog _logger = LogManager.GetLogger(typeof(_Default)); // for the instance
What would be the reason for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能是 AppPool 身份用户没有写入日志文件/目录的权限(假设您使用的是文件附加程序)。
检查AppPool用户帐户的方法如下:
如果这不是问题,我建议打开 log4net 内部调试 :
It could be that the AppPool identity user does not have permissions to write to the log file/directory (assuming you're using a file appender).
Here's how to check the AppPool user account:
If that's not the problem, I'd recommend turning on the log4net internal debugging: