<log4net>
<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
<bufferSize value="10" />
<connectionType value="System.Data.SqlClient.SqlConnection,
System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<connectionString value="data source=;User ID=;Password=" />
<commandText value="INSERT INTO Errorlog ([clientname],[username],[administration],[selectedentity],[project],[Date],[Thread],[Level],[Logger],
[Message],[Exception],[browser],[ipaddress],[url],[errormessage]) VALUES (@clientname,@username,@administration,@selectedentity,@project,@log_date, @thread, @log_level,
@logger, @message, @exception,@browser,@ipaddress,@url,@errormessage)"/>
<parameter>
<parameterName value="@clientname" />
<dbType value="String" />
<size value="50" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{clientname}" />
</layout>
</parameter>
<parameter>
<parameterName value="@username" />
<dbType value="String" />
<size value="100" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{username}" />
</layout>
</parameter>
<parameter>
<parameterName value="@administration" />
<dbType value="String" />
<size value="100" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{administration}" />
</layout>
</parameter>
<parameter>
<parameterName value="@selectedentity" />
<dbType value="String" />
<size value="100" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{selectedentity}" />
</layout>
</parameter>
<parameter>
<parameterName value="@project" />
<dbType value="String" />
<size value="100" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{project}" />
</layout>
</parameter>
<parameter>
<parameterName value="@log_date" />
<dbType value="DateTime" />
<layout type="log4net.Layout.RawTimeStampLayout" />
</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>
<parameter>
<parameterName value="@browser" />
<dbType value="String" />
<size value="100" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{browser}" />
</layout>
</parameter>
<parameter>
<parameterName value="@ipaddress" />
<dbType value="String" />
<size value="100" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{ipaddress}" />
</layout>
</parameter>
<parameter>
<parameterName value="@url" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{url}" />
</layout>
</parameter>
<parameter>
<parameterName value="@errormessage" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{errormessage}" />
</layout>
</parameter>
</appender>
<root>
<appender-ref ref="AdoNetAppender"/>
</root>
</log4net>
答案 0 :(得分:2)
Buffersize
仅指定在提交之前应在RAM中保留多少项。它没有定义记录器的Lossy。
要定义有损记录器,您需要明确说明并定义可丢失的内容:
<lossy value="true"/>
<evaluator type="log4net.Core.LevelEvaluator">
<threshold value="ERROR" />
</evaluator>