Ian,

As you have written a custom appender I don't know exactly what your
code is doing. The standard AdoNetAppender does cache the IDbCommand
object use to write into the database. The implementation of the command
object for SQL server does cache the value of the parameters (the
implementation may vary for other database providers).

If you don't want to log a value for a parameter then I assume that you
would need to set the value to DBNull, which would clear the value. This
may send the null value to the server, which may not be what you intend.
In that case you may need to remove the parameter, or perhaps just
create two separate command objects one with 3 parameters and one with
10, or just create the command object for each log event.

Nicko

> -----Original Message-----
> From: Ian Bell [mailto:[EMAIL PROTECTED] 
> Sent: 02 March 2005 19:27
> To: [email protected]
> Subject: ADO Parameter Caching
> 
> 
> Hi 
> 
> I may be chasing a red herring here...
> 
> I've written a custom ADO appender based on the appender 
> skeleton - the code's pretty much similar to the example 
> appender, except I parse the message from the event (it's 
> xml) and use the values there-in for the parameters. I've a 
> stored proc defined in the config that takes 10 params -
> 3 are mandatory. Everything works fine, as in I get my events 
> logged to the db when I send in both a full list or just the 
> bare min. However, I'm experiencing problems in that if I log 
> with the full parameter set, then after with a mininal set, 
> it seems as though the parameters are caching somehow - the 
> mininal set still logs with the full set of parameters set in 
> the previous call (sorry, it's hard to explain!) 
> 
> When I close the app and restart, it's all reset to normal. 
> Is there any sort of caching going on in log4net? 
> 
> regards 
> 
> Ian 
> 
> 

Reply via email to