标签:sel out neu eset config start evel nta sof
在AssemblyInfo.cs文件中添加[assembly: log4net.Config.XmlConfigurator(Watch = true)];
或者在Global.asax文件中执行:
void Application_Start(object sender, EventArgs e)
{
//在应用程序启动时运行的代码
log4net.Config.DOMConfigurator.Configure();
}
app.config中配置如下:
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</configSections>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<param name="File" value="C:\LogFile\ADSync.log.txt" />
<param name="AppendToFile" value="true" />
<param name="MaxSizeRollBackups" value="10" />
<param name="MaximumFileSize" value="5MB" />
<param name="RollingStyle" value="Size" />
<param name="StaticLogFileName" value="false" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<root>
<level value="DEBUG" />
<appender-ref ref="RollingLogFileAppender" />
</root>
</log4net>
标签:sel out neu eset config start evel nta sof
原文地址:https://www.cnblogs.com/johnblogs/p/9542546.html