我在用于记录的Oracle存储过程中有一个输出参数(返回受影响的行数 - 如果过程成功,则应为1)。请注意,我不打算使用日志记录中的返回值,但是其他程序使用它并在其他地方使用它,我希望不会偏离此模式进行日志记录过程。
然而,我似乎无法:
程序类似于:
CREATE OR REPLACE PROCEDURE USERS.LOGS_INSERT
(
p_Date IN DATE DEFAULT NULL,
p_Source IN VARCHAR2 DEFAULT NULL,
p_Host IN VARCHAR2 DEFAULT NULL,
p_Level IN VARCHAR2 DEFAULT NULL,
p_Message IN VARCHAR2 DEFAULT NULL,
p_Stack_Trace IN VARCHAR2 DEFAULT NULL,
p_RowsAffected OUT NUMBER
)
AS
BEGIN
INSERT INTO LOGS (LOG_DATE, LOG_SOURCE, LOG_SOURCE_HOST, LOG_LEVEL, LOG_MESSAGE, LOG_STACK_TRACE)
VALUES (p_Date, p_Source, p_Host, p_Level, p_Message, p_Stack_Trace);
p_RowsAffected := SQL%ROWCOUNT;
EXCEPTION
WHEN NO_DATA_FOUND THEN
p_RowsAffected := 0;
WHEN TOO_MANY_ROWS THEN
p_RowsAffected := -2;
WHEN OTHERS THEN
p_RowsAffected := -1;
END;
/
.config文件包含:
<!-- language: lang-xml -->
<appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
<param name="Threshold" value="INFO"/>
<bufferSize value="1"/>
<connectionType value="System.Data.OracleClient.OracleConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
<commandType value="StoredProcedure"/>
<parameter>
<parameterName value="p_Date"/>
<dbType value="DateTime"/>
<layout type="log4net.Layout.RawTimeStampLayout"/>
</parameter>
<parameter>
<parameterName value="p_Source"/>
<dbType value="String"/>
<size value="255"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{application}"/>
</layout>
</parameter>
<parameter>
<parameterName value="p_Host"/>
<dbType value="String"/>
<size value="100"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{log4net:HostName}"/>
</layout>
</parameter>
<parameter>
<parameterName value="p_Level"/>
<dbType value="String"/>
<size value="50"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%level"/>
</layout>
</parameter>
<parameter>
<parameterName value="p_Message"/>
<dbType value="String"/>
<size value="4000"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%message"/>
</layout>
</parameter>
<parameter>
<parameterName value="p_Stack_Trace"/>
<dbType value="String"/>
<size value="4000"/>
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%property{stack}"/>
</layout>
</parameter>
<parameter>
<parameterName value="p_RowsAffected"/>
<dbType value="Int32"/>
</parameter>
</appender>
我错过了什么吗?