Web.Config中的Log4Net部分生成错误 [英] Log4Net section in Web.Config generates Error
问题描述
所以我想在我的Web .NET 4.0应用程序中设置Log4Net。我添加了正确的.dll到我的项目,并附加以下到我的Web.Config文件作为启动器:
So I am trying to set up Log4Net in my Web .NET 4.0 application. I have added the correct .dll to my project and have appended the following to my Web.Config file as starters:
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingLogFileAppender" />
</root>
</configSections>
<log4net debug="true">
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\\TestProj\\TestLog.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5p %d %5rms %-22.22c{1} %-18.18M - %m%n" />
</layout>
</appender>
log4net部分到Web.Config,我会收到错误消息
However, if I append the "log4net" section to Web.Config, I will receive the error message
无法在Web服务器上开始调试。请参阅常见的
配置问题的帮助.....
Unable to start debugging on the web server. See help for common configuration problems.....
确保服务器正常运行。验证没有语法
错误在web.config ........
Make sure the server is running correctly. Verify there are no syntax errors in the web.config........
注意
我可以删除本节的所有内部资料,只留下以下声明:
NOTE I can remove all the internals of this section and leave only the declaration:
<log4net></log4net>
,我仍然会得到同样的错误。
and I will still get the same error.
有人可以告诉我如何跟踪这个错误吗?
Can someone give me some pointers on how to track down this error?
推荐答案
log4net文档首页。
机会是你' ve misplaced required tags。
Take a look at a sample configurations at log4net documentation homepage.
Chances are you've misplaced required tags.
这篇关于Web.Config中的Log4Net部分生成错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!