Skip to content

Use Oracle as Log Target #32

@andreasbraidt

Description

@andreasbraidt

Hi,
i've seen a past issue with logging to Oracle DB. I tried to configure it. I've already included the Oracle.ManagedDataAccess.Core package in my project and configured log4net in this way:

    <appender name="AdoNetAppender" type="MicroKnights.Logging.AdoNetAppender, MicroKnights.Log4NetAdoNetAppender">
        <connectionType value="Oracle.ManagedDataAccess.Client.OracleConnection, Oracle.ManagedDataAccess, Version=3.1.21.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
        <connectionStringName value="OracleConnection" />
        <connectionStringFile value="appsettings.json" />

This works at the first sight, but i get an exception

   at MicroKnights.Logging.AdoNetAppender.SendBuffer(LoggingEvent[] events)
Oracle.ManagedDataAccess.Client.OracleException (0x80004005): ORA-01006: bind variable does not exist
   at OracleInternal.ServiceObjects.OracleConnectionImpl.VerifyExecution(Int32& cursorId, Boolean bThrowArrayBindRelatedErrors, SqlStatementType sqlStatementType, Int32 arrayBindCount, OracleException& exceptionForArrayBindDML, Boolean& hasMoreRowsInDB, Boolean bFirstIterationDone)
   at OracleInternal.ServiceObjects.OracleCommandImpl.ExecuteNonQuery(String commandText, OracleParameterCollection paramColl, CommandType commandType, OracleConnectionImpl connectionImpl, Int32 longFetchSize, Int64 clientInitialLOBFS, OracleDependencyImpl orclDependencyImpl, Int64[]& scnFromExecution, OracleParameterCollection& bindByPositionParamColl, Boolean& bBindParamPresent, OracleException& exceptionForArrayBindDML, OracleConnection connection, OracleLogicalTransaction& oracleLogicalTransaction, Boolean isFromEF)
   at Oracle.ManagedDataAccess.Client.OracleCommand.ExecuteNonQuery()
   at MicroKnights.Logging.AdoNetAppender.SendBuffer(IDbTransaction dbTran, LoggingEvent[] events)
   at MicroKnights.Logging.AdoNetAppender.SendBuffer(LoggingEvent[] events)

my parameters are configured like these:

        <parameter>
            <parameterName value=":message" />
            <dbType value="String" />
            <size value="4000" />
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%message" />
            </layout>
        </parameter>

I already tried "@" and ":" and checked case etc.

As i get already an ORA- Error the connection to the DB seems to be established.
When i configure a insert statement without any variables then i get the recorid inserted into the table.
As soon as i add one variable then the error occurs.

Have i missed something in my configuration?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions