开发者

Log4net just stopped working, got a reason why, but don't know how to fix it

开发者 https://www.devze.com 2022-12-09 05:48 出处:网络
My log4net used to work, and not sure exactly when it stopped working, but today when I put the application onto a production server, I noticed no logs getting produced, here is the reason why, does a

My log4net used to work, and not sure exactly when it stopped working, but today when I put the application onto a production server, I noticed no logs getting produced, here is the reason why, does anyone know how to fix this?

log4net: log4net assembly [log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821]. Loaded from [C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\webservices\5da47f19\dc42c9c9\assembly\dl3\8f8d7275\00beb281_ec53c601\log4net.DLL]. (.NET Runtime [2.0.50727.4927] on Microsoft Windows NT 6.1.7600.0)
log4net: DefaultRepositorySelector: defaultRepositoryType [log4net.Repository.Hierarchy开发者_如何转开发.Hierarchy]
log4net: DefaultRepositorySelector: Creating repository for assembly [ISDS, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]
log4net: DefaultRepositorySelector: Assembly [MyASM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] Loaded From [C:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\webservices\5da47f19\dc42c9c9\assembly\dl3\38092252\c8d83679_5e56ca01\ISDS.DLL]
log4net: DefaultRepositorySelector: Assembly [MyASM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] **does not have a RepositoryAttribute specified**.
log4net: DefaultRepositorySelector: Assembly [MyASM, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] using repository [log4net-default-repository] and repository type [log4net.Repository.Hierarchy.Hierarchy]
log4net: DefaultRepositorySelector: Creating repository [log4net-default-repository] using type [log4net.Repository.Hierarchy.Hierarchy]


One reason this happens is when the loading order of assemblies changes, and you have a log reference before your log4net configuration.

Where is log4net configured in your application? If it's programmatically, trace it and ensure that log4net is being configured before your first call to GetLogger. I tend to throw a log reference just after I configure log4net, to ensure this.

XmlConfigurator.ConfigureAndWatch(new FileInfo("log4net.config"));
log = LogManager.GetLogger(...));
0

精彩评论

暂无评论...
验证码 换一张
取 消