Shouldn't be a TextWriterAppender there. Can you post your configuration file?
Not answering your question but as a workaround you could loop through the list of appenders returned and find the first (or named) instance of AdoNetAppender you're looking for. Regards, Dag From: Gourlay, Colin [mailto:[EMAIL PROTECTED] Sent: Thursday, October 16, 2008 3:28 PM To: [email protected] Subject: AdoNetAppender Connection String Hello. I am trying to retrieve the connection string within my logging.config (a separate file outside the web.config in case that is significant) file. I am using the code below but it seems to use a default(?) logger which is not defined in my config file (a TextWriterAppender). I am wondering if this is occurring because the config file cant be located or the code I am using is just wrong. Pointers/Tips/Advice very much appreciated. internal static string LoggerConnectionString { get { // determine the logging hierarchy Hierarchy log4netHierarchy = LogManager.GetRepository() as Hierarchy; // magic number used because there should only ever be one appender defined in this application // the appender variable evaluates to null! AdoNetAppender appender = log4netHierarchy.Root.Appenders[0] as AdoNetAppender; // return connection string if it is found return appender.ConnectionString ?? string.Empty; } } ________________________________________ Edinburgh Business School is a Charity Registered in Scotland, SC026900 ########################################### This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange. For more information, connect to http://www.f-secure.com/
