私の App.config を以下に示します。ファイルは、次の呼び出しと同じプロジェクトです。
log4net.Config.XmlConfigurator.Configure();
private static log4net.ILog Log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
しかし、私は受け取っています:
Log4net: エラー XmlConfigurator アプリケーションの .config ファイルで構成セクション 'log4net' が見つかりませんでした。
<log4net>
および<configSections>
要素の .config ファイルを確認します。構成セクションは次のようになります。<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /
log4netを始めたばかりなので、ばかげた間違いをしているように感じます。これについて何か助けはありますか?
<!-- language: xml -->
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>
<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\log-file.txt" />
<appendToFile value="true"/>
<rollingStyle value="Size" />
<maximumFileSize value="1MB" />
<staticLogFileName value="true" />
<maxSizeRollBackups value="10" />
<conversionPattern value="%date [%thread] %-5level %location %logger - %message%newline" />
<layout type="log4net.Layout.SimpleLayout" />
</appender>
<root>
<level value="ALL" />
<appender-ref ref="RollingFileAppender" />
</root>
</log4net>
</configuration>