我第一次尝试配置 log4net,我确信我已经正确配置了所有内容,但是,在获得空日志文件后,我打开了 log4net 调试器。我现在不断看到以下错误:
log4net:ERROR [RollingFileAppender] ErrorCode: GenericFailure. Unable to acquire lock on
file "file path\file name" The process cannot access the file "file path\file name" because
it is being used by another process.
因此,我目前通过我的 Web.config 文件配置了 log4net:
<log4net debug="true">
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="Logs\\TransferPicturesApplicationLog.txt"/>
<appendToFile value="true"/>
<rollingStyle value="Size"/>
<maxSizeRollBackups value="5"/>
<maximumFileSize value="10MB"/>
<staticLogFileName value="true"/>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="ERROR"/>
<param name="LevelMax" value="DEBUG"/>
</filter>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %level %logger - %message%newline"/>
</layout>
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
</appender>
<root>
<level value="INFO"/>
<appender-ref ref="RollingFileAppender"/>
</root>
<logger>
<level value="DEBUG"/>
<appender-ref ref="RollingFileAppender"/>
</logger>
</log4net>
帮助!!!