在开发环境中,我的 Web 应用程序正确记录了所有消息。在舞台环境中,会记录 global.asax 中的 session_end 事件,但不会记录 global.asax 之外的任何内容。在 dev 上,当我启动应用程序时,我可以看到一个基本日志,显示我正在登录,但没有任何内容。
-code is same in both environments
-.NET 4.0 web application deployed to IIS
-log4net.config is same in both environments
-logs to text file on same drive as application that runs it
-logger is instantiated in static class, used through whole application.
-global.asax application_start configures logger by building FileInfo object that points to log4net.config and doing this log4net.Config.XmlConfigurator.ConfigureAndWatch(file);
有人有什么建议吗?如果这个问题含糊不清或需要更多信息,我很抱歉。我不确定从哪里开始对此进行故障排除。我会添加任何要求的信息。
最佳答案
您的应用程序池中的用户需要对日志目录具有写入权限,检查两个环境中的权限是否相同。
关于c# - 在除一个环境之外的所有环境中进行日志记录 - log4net,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18090003/