Can you not encrypt the portion of log4net in App.config?
_____ From: Theron Kousek [mailto:[EMAIL PROTECTED] Sent: 23 April 2007 17:41 To: [email protected] Subject: Is there a way to use log4net without the App.Config file all-together? Hi All: Maybe you can point me in the right direction. I'm using .NET 1.1 and log4net 1.2. I was able to get log4net integrated into a WinForms application in C#. My manager asked if I could completely remove all log4net dependencies to the App.Config file. I was able to pull out all of the entries in between: <log4net> .... </log4net> (and now get them from a database row as a clob) and have them streamed into the XmlConfigurator.Configure(...). However, I discovered that I must still have the following in the App.Config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <sectionGroup name="common"> <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" /> </sectionGroup> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" /> </configSections> <common> <logging> <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net"> <!-- choices are INLINE, FILE, FILE-WATCH, EXTERNAL--> <!-- otherwise BasicConfigurer.Configure is used --> <!-- log4net configuration file is specified with key configFile--> <arg key="configType" value="INLINE" /> </factoryAdapter> </logging> </common> </configuration> If I attempt to "pull out" the above from the app.config and "stream" it into the XmlConfigurator, the call to private static readonly ILog Log = LogManager.GetLogger(typeof(MainForm)); ends up returning an instance of Common.Logging.Simple.NoOpLogger rather than Common.Logging.Log4net.Log4NetLogger. Does anyone know of a way that I can completely do away with the Config file (as per my manager's request) and programmatically load the Log4net runtime with the data that would otherwise be contained in the App.Config "section data" section? Thanks in advance for any help!!! Theron Kousek Keefe Commissary Network Phone (314) 919-4172 Fax: (314) 919-4109 Email: [EMAIL PROTECTED]
