Posts

Showing posts from April, 2010

log4net AdoNetAppender Connection String from App Config

Currently log4net version 1.2.10.0 is not supporting reading connection strings from or directly. But in order to read connection string from < appSettings>, we have to  override ActivateOptions and ConnectionString property of AdoNetAppender.  Here is the code: AppSettingsConnectionStringAdoNetAppender.cs file namespace MyNameSpace { [ Serializable ()]     public class AppSettingsConnectionStringAdoNetAppender : AdoNetAppender     {         public override void ActivateOptions()         {             PopulateConnectionString();                         base .ActivateOptions();         }         private void PopulateConnectionString()         {             ConnectionString = ConnectionString;         }          public new string ConnectionString         {             get { return base .ConnectionString; }             set {                     base .ConnectionString                        = ConfigurationManager .AppSettings[ "conn1" ].ToStr