logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Parkinson" <devn.ke...@gmail.com>
Subject How is Layout Read In Using The ADONetAppender?
Date Thu, 12 Jul 2007 18:48:45 GMT
Hello All:

     Currently I am looking into extending some log4net capabilities around
using the AdoNETAppender to accommodate my table structure.

There is one thing I am having a hard time grasping and that is how the
values for the parameters in an AdnoNetAppender are read in.

Consider t he following declaration of an AdoNetAppender in t he
log4net.config:

<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
    <bufferSize value="100" />
    <connectionType value="System.Data.SqlClient.SqlConnection,
System.Data, Version=1.0.3300.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089" />
    <connectionString value="data source=[database server];initial
catalog=[database name];integrated security=false;persist security
info=True;User ID=[user];Password=[password]" />
    <commandText value="INSERT INTO Log
([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES
(@log_date, @thread, @log_level, @logger, @message, @exception)" />
    <parameter>
        <parameterName value="@thread" />
        <dbType value="String" />
        <size value="255" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%thread" />
        </layout>
    </parameter>
    ...
    ...
    ...
</appender>

I understand that the <parameter> node is  read in as an
AdoNetAppenderParameter, but I am not clear how the PatternLayout is
usesd to read the value of %thread. Can anyone offer an explanation of
this?

The end goal here is to have the value  attrib of <layout> be a
property on one of my custom classes.

Thank you,
Kevin Parkinson

Mime
View raw message