You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
3.9 KiB
Plaintext
100 lines
3.9 KiB
Plaintext
2 years ago
|
<?xml version="1.0" encoding="utf-8" ?>
|
||
|
<configuration>
|
||
|
<configSections>
|
||
|
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" requirePermission="false" />
|
||
|
</configSections>
|
||
|
<log4net>
|
||
|
<root>
|
||
|
<!-- Value of priority may be ALL, DEBUG, INFO, WARN, ERROR, FATAL, OFF -->
|
||
|
<level value="DEBUG" />
|
||
|
<appender-ref ref="DebugAppender" />
|
||
|
<appender-ref ref="ErrorAppender" />
|
||
|
<!--<appender-ref ref="AdoNetAppender_MySql" />-->
|
||
|
</root>
|
||
|
<appender name="DebugAppender" type="log4net.Appender.RollingFileAppender">
|
||
|
<!-- debug log: 记录 DEBUG, INFO 级别的日志 -->
|
||
|
<file value="App_Data\\Logs\\debug.log" />
|
||
|
<appendToFile value="true" />
|
||
|
<rollingStyle value="Composite" />
|
||
|
<datePattern value="yyyyMMdd" />
|
||
|
<maxSizeRollBackups value="100" />
|
||
|
<maximumFileSize value="10MB" />
|
||
|
<staticLogFileName value="true" />
|
||
|
<layout type="log4net.Layout.PatternLayout" >
|
||
|
<param name="ConversionPattern" value="%date [%p] [%logger] [%thread] - %message%newline" />
|
||
|
</layout>
|
||
|
<filter type="log4net.Filter.LevelRangeFilter">
|
||
|
<levelMax value="INFO" />
|
||
|
</filter>
|
||
|
</appender>
|
||
|
<appender name="ErrorAppender" type="log4net.Appender.RollingFileAppender">
|
||
|
<!-- error log: 记录 WARN,ERROR,FATAL 级别的日志 -->
|
||
|
<file value="App_Data\\Logs\\error.log" />
|
||
|
<appendToFile value="true" />
|
||
|
<rollingStyle value="Composite" />
|
||
|
<datePattern value="yyyyMMdd" />
|
||
|
<maxSizeRollBackups value="10" />
|
||
|
<maximumFileSize value="10MB" />
|
||
|
<staticLogFileName value="true" />
|
||
|
<layout type="log4net.Layout.PatternLayout" >
|
||
|
<param name="ConversionPattern" value="%date [%p] [%logger] [%thread] - %message%newline" />
|
||
|
</layout>
|
||
|
<filter type="log4net.Filter.LevelRangeFilter">
|
||
|
<levelMin value="WARN" />
|
||
|
</filter>
|
||
|
</appender>
|
||
|
<appender name="AdoNetAppender_MySql" type="log4net.Appender.AdoNetAppender">
|
||
|
|
||
|
<bufferSize value="1"/>
|
||
|
<param name="ConnectionType" value="MySql.Data.MySqlClient.MySqlConnection, MySql.Data"/>
|
||
|
|
||
|
<param name="ConnectionString" value="server=101.42.137.198;port=12306;database=log_test;Uid=root;Pwd=123456;"/>
|
||
|
<commandText value="INSERT INTO log4net(log_datetime,log_thread,log_level,log_logger,log_message,Exception) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)"/>
|
||
|
<parameter>
|
||
|
<parameterName value="@log_date"/>
|
||
|
<dbType value="DateTime"/>
|
||
|
<layout type="log4net.Layout.RawTimeStampLayout"/>
|
||
|
<!--<layout type="log4net.Layout.PatternLayout" value="%date{yyyy'-'MM'-'dd HH':'mm':'ss}" />-->
|
||
|
</parameter>
|
||
|
<parameter>
|
||
|
<parameterName value="@thread"/>
|
||
|
<dbType value="String"/>
|
||
|
<size value="255"/>
|
||
|
<layout type="log4net.Layout.PatternLayout">
|
||
|
<conversionPattern value="%thread"/>
|
||
|
</layout>
|
||
|
</parameter>
|
||
|
<parameter>
|
||
|
<parameterName value="@log_level"/>
|
||
|
<dbType value="String"/>
|
||
|
<size value="50"/>
|
||
|
<layout type="log4net.Layout.PatternLayout">
|
||
|
<conversionPattern value="%level"/>
|
||
|
</layout>
|
||
|
</parameter>
|
||
|
<parameter>
|
||
|
<parameterName value="@logger"/>
|
||
|
<dbType value="String"/>
|
||
|
<size value="255"/>
|
||
|
<layout type="log4net.Layout.PatternLayout">
|
||
|
<conversionPattern value="%logger"/>
|
||
|
</layout>
|
||
|
</parameter>
|
||
|
<parameter>
|
||
|
<parameterName value="@message"/>
|
||
|
<dbType value="String"/>
|
||
|
<size value="4000"/>
|
||
|
<layout type="log4net.Layout.PatternLayout">
|
||
|
<conversionPattern value="%message"/>
|
||
|
</layout>
|
||
|
</parameter>
|
||
|
<parameter>
|
||
|
<parameterName value="@exception"/>
|
||
|
<dbType value="String"/>
|
||
|
<size value="2000"/>
|
||
|
<layout type="log4net.Layout.ExceptionLayout"/>
|
||
|
</parameter>
|
||
|
</appender>
|
||
|
</log4net>
|
||
|
</configuration>
|