我正在看到一些我正在研究的项目真的很奇怪。
我在MVC网站上使用了log4net,这很有效。
然后,我正在开发一个完全不相关的控制台应用程序,该应用程序使用SharePoint API,并且只要包含以下行(其他行不会导致问题)
SPLimitedWebPartManager spWebPartManager = web.GetLimitedWebPartManager(“http://blah/blah.aspx?PageView=Shared”,System.Web.UI.WebControls.WebParts.PersonalizationScope.Shared);
我在控制台应用中收到以下消息
log4net:ERROR XmlConfigurator: Failed to find configuration section 'log4net' in
the application's .config file. Check your .config file for the <log4net> and <
configSections> elements. The configuration section should look like: <section n
ame="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /
>
log4net:ERROR XmlConfigurator: Failed to find configuration section 'log4net' in
the application's .config file. Check your .config file for the <log4net> and <
configSections> elements. The configuration section should look like: <section n
ame="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /
>
经过一段小小的延迟,我得到了两次。延迟可能是从页面获取Web部件管理器的请求,但我不确定为什么在此项目中出现此log4net错误。我已经浏览了代码和bin文件夹等,没有找到任何log4net提及的痕迹。
为什么会发生这种情况的任何想法?
答案 0 :(得分:3)
除非以某种方式使用东西,否则东西不会产生错误,必须在那里间接引用log4net。您使用的是依赖于log4net的任何第三方库,还是某种使用它的错误处理库。最可能的错误解释是代码行正在抛出一个异常,该异常正在尝试使用log4net记录错误的错误处理例程,然后不能因为没有log4net配置。
答案 1 :(得分:1)
G4中的Log4Net是什么?
您的应用程序是否引用任何外部类库?也许其中一个使用Log4Net并期望为Log4Net设置客户端的配置。