> I have created a component to abstract the logging > functionality of log4net. > For ease, we'll call this component, 'Foo.dll'. > > 'Foo.dll', is used in all applications for logging. A static > method is called for each logging statement. > > I am trying to figure out how to configure the log4net logger > through 'Foo.dll'. I have created a configuration file named > 'Foo.dll.log4net'. I have placed the following code in the > AsemblyInfo class of 'Foo.dll': > > [assembly:log4net.Config.DOMConfigurator(ConfigFile="Foo.dll.log4net", > ConfigFileExtension="log4net",Watch=true)]
Both ConfigFile="Foo.dll.log4net" and ConfigFileExtension="log4net" should have the same effect. You can specify either. Specifying ConfigFile will override ConfigFileExtension (if they were different). > I am confused as to where I must place the Foo.dll.log4net > configuration file. Within the parent application's project > or target directory? With the 'Foo.dll' assembly? Log4net? The config file goes in the AppDomain.CurrentDomain.BaseDirectory. This is the directory with the app.config or web.config file. This may or may not be the directory containing the Foo.dll file. > > Any help would be greatly appreciated. Thanks. > > Matthew Griffore > Log4net will print out the full path to the config file it is trying to load if you enable internal debugging: http://logging.apache.org/log4net/release/manual/faq.html#internalDebug Cheers, Nicko
