Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<appender name="TracingAppenderDatabase" type="log4net.Appender.AdoNetAppender">
<bufferSize value="10" />
<connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<connectionStringName value="MyContext" />
<commandText value="INSERT INTO Logs ([Date],[Thread],[Level],[Logger],[Message],[Exception], [Category], [User]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception, @Category, @User)" />
<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="@Category" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{Category}" />
</layout>
</parameter>
<parameter>
<parameterName value="@User" />
<dbType value="String" />
<size value="255" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%HTTPUser" />
<converter>
<name value="HTTPUser" />
<type value="hbulens.Logging.HttpContextUserPatternConverter" />
</converter>
</layout>
</parameter>
</appender>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.