logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karel Kral <kral.k...@volny.cz>
Subject Bug with ADONetAppender + MS Access on .NET 2.0
Date Mon, 13 Nov 2006 09:50:25 GMT
Hi all,

When trying to log into an access db using the AdoNetAdapter with an
OleDb connection i get the following error in a  VS 2005 (.NET 2.0)
project (see bellow). I am logging from log4net sample app ConsoleApp,
config file is attached.

I have found exactly same question in mailing list archive (06/10/2006
11:44 AM Subject: Trouble using AdoNetAdapter with .net 2.0 project),
but without any workaround. Is there any workaround?

-------------------------------------------------------------
Transalation of Exception message:
COM object that has been separated from its underlying RCW cannot be used.

log4net:ERROR [AdoNetAppender] Exception while writing to database
System.Runtime.InteropServices.InvalidComObjectException: Objekt COM,
který byl oddělen od nadřízené obálky RCW, nelze použít (see translation).
   v System.Data.Common.UnsafeNativeMethods.ICommandText.Execute(IntPtr
pUnkOuter, Guid& riid, tagDBPARAMS pDBParams, IntPtr& pcRowsAffected,
Object& ppRowset)
   v
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
   v System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
   v System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
   v
System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
   v System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
   v log4net.Appender.AdoNetAppender.SendBuffer(IDbTransaction dbTran,
LoggingEvent[] events)
   v log4net.Appender.AdoNetAppender.SendBuffer(LoggingEvent[] events)
log4net:WARN AdoNetAppender: Exception while disposing cached command object
System.Runtime.InteropServices.InvalidComObjectException: Objekt COM,
který byl oddělen od nadřízené obálky RCW, nelze použít.
   v
System.Data.Common.UnsafeNativeMethods.IAccessor.ReleaseAccessor(IntPtr
hAccessor, Int32& pcRefCount)
   v System.Data.OleDb.RowBinding.Dispose()
   v System.Data.OleDb.Bindings.Dispose()
   v System.Data.OleDb.OleDbCommand.CloseInternal()
   v System.Data.OleDb.OleDbCommand.ResetConnection()
   v System.Data.OleDb.OleDbCommand.Dispose(Boolean disposing)
   v System.ComponentModel.Component.Dispose()
   v log4net.Appender.AdoNetAppender.OnClose()
The program '[5764] ConsoleApp.vshost.exe: Managed' has exited with code
0 (0x0).

--------------------------------------------------------------------
	<!-- This section contains the log4net configuration settings -->
	<log4net>
    <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
      <connectionString value="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\Projekty\Kasa8\Data\Kasa8.mdb" />
      <commandText value="INSERT INTO ZpravyKasy
([Date],[Thread],[Level],[Logger],[Message]) VALUES (@log_date, @thread,
@log_level, @logger, @message)" />
      <buffersize value="10"/>
      <parameter>
        <parameterName value="@log_date" />
        <dbType value="DateTime" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%date{yyyy.MM.dd HH:mm:ss}" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@thread" />
        <dbType value="String" />
        <size value="40" />
        <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="60" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%logger" />
        </layout>
      </parameter>
      <parameter>
        <parameterName value="@message" />
        <dbType value="String" />
        <size value="255" />
        <layout type="log4net.Layout.PatternLayout">
          <conversionPattern value="%message" />
        </layout>
      </parameter>
    </appender>

    <!-- Setup the root category, add the appenders and set the default
level -->
		<root>
			<level value="DEBUG" />
			<appender-ref ref="AdoNetAppender" />
		</root>
	</log4net>

-- 
___________________________________________________
Karel Kral, vyvojar
ANETE, s.r.o.
___________________________________________________

Mime
View raw message