我根据互联网教程修改了app.config以设置 log4view,之后我在代码的确切位置得到了一个关于配置的异常,
System.Configuration.dll 中的“System.Configuration.ConfigurationErrorsException”配置初始化错误
抛出此异常的确切点在这里(这发生在线程内部):
ServicePointManager.Expect100Continue = False
到目前为止,我没有编译或运行时错误。
这是我的app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
<root>
<level value="DEBUG"/>
<appender-ref ref="FileAppender"/>
<appender-ref ref="RollingFileAppender" />
</root>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%ndc]
- %message%newline"/>
</layout>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\temp\TwitterStreamListener.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="5" />
<maximumFileSize value="1MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %level %logger - %message%newline" />
</layout>
</appender>
</log4net>
</configuration>