logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrei Leca" <andrei.l...@rms.ro>
Subject FW: AdoNetAppender: can not read custom properties from LoggingEvent using configuration file
Date Wed, 23 Jul 2008 12:06:04 GMT
I used a extended log using example:      

 

http://svn.apache.org/viewvc/logging/log4net/trunk/extensions/net/1.0/log4ne

t.Ext.EventID/cs/src/EventIDLogImpl.cs?view=co .

 

 

 

 I have properties InstanceId that is setted in extended log:  

 

            LoggingEvent loggingEvent = new

 

                  LoggingEvent(ThisDeclaringType, Logger.Repository,
Logger.Name,

 

                                                             Level.Info,
message, exc);

 

            loggingEvent.Properties["InstanceId"] = logData.DCSInstanceId;

 

            Logger.Log(loggingEvent);

 

 I received error: 

 

      [6108] log4net:ERROR XmlHierarchyConfigurator: Cannot find Property
[conversionPattern] to set object on
[log4net.Appender.AdoNetAppenderParameter] 

 

 

 

 Where it is the problem? Do you can help me? The logs works correctly if
uses other appender: "log4net.Appender.OutputDebugStringAppender"

 

 

 

 

 

I used log4net 1.2.10.0(windows) with following configuration for log4net:

 

 

 

<log4net>

 

    <appender name="AdoNetAppender_SqlServer"

 

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=XXX; initial catalog=XXX;
integrated security=false;persist security info=True;User
ID=XXX;Password=XXX" /> 

 

    <commandText value="[Routine].[usp_InsertLog]" />

 

    <commandType value="StoredProcedure" />

 

    <parameter>

 

        <parameterName value="@log_date" />

 

        <dbType value="DateTime" />

 

        <layout type="log4net.Layout.RawTimeStampLayout" />

 

    </parameter>

 

    <parameter>

 

        <parameterName value="@message" />

 

        <dbType value="String" />

 

        <size value="4000" />

 

        <layout type="log4net.Layout.PatternLayout">

 

        <conversionPattern value="%message" />

 

        </layout>

 

    </parameter>

 

    <parameter>

 

          <parameterName value="@instance_id" />

 

          <dbType value="int32" /> 

 

          <layout type="Dcs.Log.ProtocolInfoPatternLayout, Dcs.Log" />

 

          <layout type="log4net.Layout.PatternLayout">

 

          <conversionPattern value="%P{InstanceId}" />

 

    </parameter>

 

</appender>

 

 

 

<root>

 

      <level value="DEBUG" />

 

      <appender-ref ref="DebugView" />

 

      <appender-ref ref="AdoNetAppender_SqlServer" /> </root> </log4net>

 

 

 

Have a nice day

 

Andy

 


Mime
View raw message