Hi Pat,

You are welcome! :-) And because you are such a thankful person.. here is 
more help (hopefully) :-) (JK)

I am assuming that you are using the ADO.NET appender to log to some 
database (SQL Server/Oracle etc.). Your commandText value should be the 
stored procedure name and the commandType should be "StoredProcedure".

The following snippet might help you. (It logs to an oracle database using 
datasource DSNAME using a stored procedure pkg_logger.log.

                <appender name="AuditAppender" 
type="log4net.Appender.ADONetAppender">
                        <connectionType 
value="Oracle.DataAccess.Client.OracleConnection, Oracle.DataAccess, 
Version=10.1.0.200, Culture=neutral, PublicKeyToken=89b483f429c47342" />
                        <connectionString value="Data Source=DSNAME;User 
ID=uid;Password=pwd" />
                        <commandText value="pkg_logger.log" />
                        <commandType value="StoredProcedure" />
                        <bufferSize value="1" />

DSNAME is your datasource name. Ex: The TNSORA entry if you are using 
Oracle.

Hope that helps.

Regards,
Kiran Raja.




"Patrick Cheng" <[EMAIL PROTECTED]> 
12/28/2004 10:08 PM
Please respond to
"Log4NET User" <[email protected]>


To
"Log4NET User" <[email protected]>
cc

Subject
Calling Stored Procedure in CommandText in config file






Hi,
  As the subject stated, How can i call a stored proc in the CommandText 
in
a config file?
I have been searching for it, but i'm unable to find a concrete example on
it. The docs simply said
we can write insert statements, or stored proc there. But i failed to
execute my stored proc. (which works
fine if i use insert statement, and the stored proc works fine in sql
analyser)
i tried
   <commandText value="exec testLogging @message"/>
and
   <commandText value="testLogging @message"/>
and they didn't work. certainly the stored proc name is testLogging and it
takes a varchar as parameter.

What am i doing wrong? The simple stored proc contains only an insert
statement..

it works fine when i substitute
   <commandText value="insert into sys_trans_log_header_history
(dealid,groupid,lstUpdDate) values (@message,999, getDate())"/>

Thanks.
Pat

PS: i would like to thank Kiran Raja and Mike Collier for their help in 
the
thread "Question on Logging customized information"





The information transmitted is intended only for the person or entity to which 
it is addressed and may contain CONFIDENTIAL material.  If you receive this 
material/information in error, please contact the sender and delete or destroy 
the material/information.

Reply via email to