我有一個C#應用程序。我想集成一個日誌文件。然後我嘗試這樣做是App.config中如何將文本寫入log4net文件
<log4net>
<appender name="FileAppender" type="log4net.Appender.FileAppender">
<file value="logfile.txt" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] – %message%newline" />
</layout>
</appender>
<appender name="InfoFileAppender" type="log4net.Appender.FileAppender">
<file value="info_logfile.txt" />
<appendToFile value="true" />
</appender>
<appender name="ErrorFileAppender" type="log4net.Appender.FileAppender">
<file value="error_logfile.txt" />
<appendToFile value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] – %message%newline" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="FileAppender" />
<level value="INFO" />
<appender-ref ref="InfoFileAppender" />
<level value="ERROR" />
<appender-ref ref="ErrorFileAppender" />
</root>
</log4net>
所以我嘗試在infoFile寫:
log.Info("chiamata json");
,但我沒有看到任何info_logfile.txt文本
哪裏是我的錯誤?
我們可以幫我嗎?
Reguards