I am trying to use the AdoNetAppender, but I am in an environment in
which the connection string is dynamic, depending on which of a series
of servers the app connects to. My idea is to get a reference to the
appender and reset the ConnectionString when my app knows which server
I am connecting to.

This sounds fine, but I only have access to an instance of an
IDbConnection. The ConnectionString property on that class returns the
connection string without the password, not surprisingly. This means
that when I set the ConnectionString property on the Appender and it
attempts to reconnect on error, it complains that I did not provide a
password.

Is it possible to set up the appender to somehow use a IDbConnection
instance instead of specifying the connection type and a connection
string and having log4net open another connection?

I have tried creating a subclass of AdoNetAppender exposing the
Connection property (so I am able to set the connection itself), but
that doesn't really fix it since it seems some internal state is being
held by AdoNetAppender. Allowing the class to reconnect on failure
tries to use the connection string, which doesn't really help.

Any ideas?

-Szymon

Reply via email to