The way we do it is, we deploy our web application, along with two Windows services, a stand-alone executable, and all the library dlls they use (mostly shared), all in the same folder. We already had it set up this way before implementing logging. A single "Log.config" file in the shared folder is read and used by log4net in all four processes. Maybe something like this could work for you.
Admitedly not an elegant solution, but it does work. -----Original Message----- From: Conant, Patrick D [mailto:[EMAIL PROTECTED] Sent: Tuesday, May 31, 2005 10:07 AM To: Log4NET User Subject: RE: Using machine.config for log4net configuration Having not received a response, I delved into the code a bit. It looks like Log4Net doesn't look in the machine.config file, so any settings there would never be read or used... Back to the drawing board... --p. -----Original Message----- From: Conant, Patrick D Sent: Friday, May 27, 2005 10:49 AM To: [email protected] Subject: Using machine.config for log4net configuration I'm trying to create central log4net configuration settings for multiple .NET components running on a single machine. I thought I'd be able to do this by putting log4net.dll in the GAC and adding log4net config settings in the machine.config file. However, my web services still look for log4net configuration in the web.config files. When I add "log4net.Internal.Debug" to the web.config file, the output is: log4net: log4net assembly [log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905]. Loaded from [Global Assembly Cache]. (.NET Runtime [1.1.4322.2032] on Microsoft Windows NT 5.1.2600.0) log4net: DefaultRepositorySelector: defaultRepositoryType [log4net.Repository.Hierarchy.Hierarchy] log4net: DefaultRepositorySelector: Creating repository for assembly [MyApp, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null] log4net: DefaultRepositorySelector: Assembly [MyApp, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null] Loaded From [c:\windows\microsoft.net\framework\v1.1.4322\temporary asp.net files\receiver\0dff92af\e29d3d6a\assembly\dl2\9d5072b7\60373264_d862c501 \MyApp.dll] log4net: DefaultRepositorySelector: Assembly [MyApp, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null] does not have a RepositoryAttribute specified. log4net: DefaultRepositorySelector: Assembly [MyApp, Version=5.0.0.0, Culture=neutral, PublicKeyToken=null] using repository [log4net-default-repository] and repository type [log4net.Repository.Hierarchy.Hierarchy] log4net: DefaultRepositorySelector: Creating repository [log4net-default-repository] using type [log4net.Repository.Hierarchy.Hierarchy] log4net: XmlConfigurator: configuring repository [log4net-default-repository] using file [C:/Work/main/MyApp/web.config] watching for file updates log4net: XmlConfigurator: configuring repository [log4net-default-repository] using file [C:/Work/main/MyApp/web.config] log4net: XmlConfigurator: configuring repository [log4net-default-repository] using stream log4net: XmlConfigurator: loading XML configuration log4net: XmlConfigurator: XML configuration does not contain a <log4net> element. Configuration Aborted. When I put the add the "log4net.Internal.Debug" setting to the machine.config, I don't get any debug output. In my machine.config file, I have the following sections: <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net, Version=1.2.9.0, Culture=neutral, PublicKeyToken=b32731d11ce58905" /> </configSections> <!-- ... --> <log4net debug="true"> <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="C:\net.log.txt" /> <appendToFile value="true" /> <maxSizeRollBackups value="10" /> <maximumFileSize value="5MB" /> <rollingStyle value="Size" /> <staticLogFileName value="true" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" /> </layout> <root> <level value="DEBUG" /> <appender-ref ref="RollingLogFileAppender" /> </root> </log4net> </configuration> Any advice on what I'm missing in order to allow central management of logging in the machine.config file? Any pointers would be appreciated. Thanks, Pat. The information contained in this e-mail and any attached documents may be privileged, confidential and protected from disclosure. If you are not the intended recipient you may not read, copy, distribute or use this information. If you have received this communication in error, please notify the sender immediately by replying to this message and then delete it from your system.
