Dar*_*der 3 .net c# configuration logging log4net
我有一个单独的Log4Net.config文件.我补充道
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)]
Run Code Online (Sandbox Code Playgroud)
到AssemblyInfo.cs
当我使用调试模式运行应用程序时,lognet正在记录.当我将应用程序发布到IIS时,lognet不会记录任何内容.
我还有以下内容:
BasicConfigurator.Configure(); // in a method
private static readonly ILog _logger = LogManager.GetLogger(typeof(_Default)); // for the instance
Run Code Online (Sandbox Code Playgroud)
这是什么原因?
可能是AppPool标识用户没有写入日志文件/目录的权限(假设您正在使用文件追加器).
以下是检查AppPool用户帐户的方法:
如果这不是问题,我建议打开log4net内部调试:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="log4net.Internal.Debug" value="true"/>
</appSettings>
</configuration>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2279 次 |
| 最近记录: |