当我将文件值设置logs\log-file.txt
为时,它将在哪里创建该文件夹?在/bin
目录中?
我的web.config看起来像这样:
<log4net>
<appender name="FileAppender" type="log4net.Appender.FileAppender">
<file value="logs\log-file.txt" />
<appendToFile value="true" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
</log4net>
这是正确的登录方式:
ILog logger = LogManager.GetLogger(typeof(CCController));
logger.Error("Some Page", ex); // where ex is the exception instance