Log4net输出:帮助找出问题所在

时间:2014-06-13 08:01:22

标签: log4net

我的配置对我来说似乎很好......我在汇编信息中有这个:

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", 
                                          Watch = true)]

但是我看到没有创建日志文件...我知道配置很好,我从另一个项目中复制它,记录得很好......

我启用了内部调试并在输出中得到了以下内容,请看看你是否可以帮助我理解它:

     log4net: log4net assembly [log4net, Version=1.2.12.0, Culture=neutral, PublicKeyToken=null]. 
 Loaded from [C:\Users\ojohnson\AppData\Local\Temp\Temporary ASP.NET Files\root \ce2cc35f\341d86e7\assembly\dl3\9a453d91\9a9af63d_14ecce01\log4net.dll]. (.NET Runtime  [4.0.30319.17929] on Microsoft Windows NT 6.1.7601 Service Pack 1)
log4net: defaultRepositoryType [log4net.Repository.Hierarchy.Hierarchy]
log4net: Creating repository for assembly [Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]
log4net: Assembly [Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null] Loaded From [Dynamic Assembly]
 log4net: Assembly [Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0,  Culture=neutral, PublicKeyToken=null] does not have a RepositoryAttribute specified.
log4net: Assembly [Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null] using repository [log4net-default-repository] and repository type     [log4net.Repository.Hierarchy.Hierarchy]
log4net: Creating repository [log4net-default-repository] using type [log4net.Repository.Hierarchy.Hierarchy]
log4net: Creating repository for assembly [Remita.STPService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]
 log4net: Assembly [Remita.STPService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] Loaded From [C:\Users\ojohnson\AppData\Local\Temp\Temporary ASP.NET Files\root\ce2cc35f\341d86e7\assembly\dl3\f305a8f8\46d161c4_da86cf01\Remita.STPService.dll]
 log4net: Assembly [Remita.STPService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] does not have a RepositoryAttribute specified.
 log4net: Assembly [Remita.STPService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] using repository [log4net-default-repository] and repository type [log4net.Repository.Hierarchy.Hierarchy]
 log4net: repository [log4net-default-repository] already exists, using repository type [log4net.Repository.Hierarchy.Hierarchy]

它在谈论什么存储库?

1 个答案:

答案 0 :(得分:1)

如果您从其他项目复制了配置,请检查您的用户是否有权访问日志记录目录。接下来,更改日志文件的名称。如果另一个项目正在记录到同一个文件,则可以将其锁定。在文件追加器中设置最小锁定时,可以从2个位置登录到一个文件。