If the connectionString property accepts a PatterString (do all
properties on all the built-in appenders accept PatternString?), you
could extend PatternConverter and expose all the values in AppSettings:
public class AppSettingsPatternConverter : PatternConverter
{
override protected void Convert(TextWriter writer, object state)
{
writer.Write(ConfigurationSettings.AppSettings[base.Option]);
}
}
<connectionString type="log4net.Util.PatternString">
<converter>
<name value="appSettings" />
<type value="AppSettingsPatternConverter, Company.Project" />
</converter>
<conversionPattern value="%appSettings{dbConnectionString}" />
</connectionString>
Where dbConnectionString is an entry in your application's config file:
<appSettings>
<add key="dbConnectionString" value="....." />
</appSettings>
--- Minh Tran <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am using version 1.2.9 BETA in an asp.net application. I've been
> looking at the ADONetAppender class & it appears to create a database
> connection upon instantiation & immediately opens the connection to
> the
> database. Even if the appender never gets called on to log a
> message,
> it is consuming an open database connection. And it doesn't return
> the
> connection to the connection pool after logging the buffered messages
> to
> the database. It only seems to return the connection when the
> appender
> is closed. Which won't occur until the appdomain shuts down. Every
> ADONetAppender creates & maintains an open connection instead of
> drawing
> from the pool. If I have several ADONetAppenders in my ASP.Net
> application, they end up holding database connections that could be
> used
> to service other requests. And when I start adding multiple servers
> to
> the web farm that hosts my application, the # of open connections
> reserved solely for Log4Net will magnify.
>
> I'd like to know if there is any on-going effort to address database
> connection pooling? Also, could a public property be added to the
> AdoNetAppender to allow it to read the connection string from
> appSettings? Ie, :
>
> public string ConnectionStringAppSettings
> {
> set {m_connectionString =
> ConfigurationSettings.AppSettings[value];}
> }
>
> Regards,
> Minh Tran
>
>