![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/2ceb81a9bcacbf39b41695959184fff8.png)
[assembly: log4net.Config.XmlConfigurator(Watch = true)]
private static readonly ILog log = LogManager.GetLogger(typeof(HomeController));
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/936f62a2cfc00026880ac22c2a87933e.png)
<configSections>
<section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
</configSections>
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/bc7c39dfeecd9ecff4b1260e1ba9d34a.png)
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="D:/myp2c_node-log2.txt" />
<appendToFile value="true" />
<rollingStyle value="Composite" />
<datePattern value="yyyyMMdd" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="1MB" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="RollingLogFileAppender" />
</root>
</log4net>