logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Gross" <Steve.Gr...@verificationsinc.com>
Subject How to verify my App.config file is being read?
Date Thu, 13 Oct 2011 16:29:47 GMT
Hi folks. I'm using TFS 2010, and am trying to get log4net working.
Here's what I've done:

1. Created an App.config file with contents like so:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
  </configSections>
  <appSettings>
    <add key="config.type" value="unit.test"/>
  </appSettings>
  <log4net>
    <appender name="NUnitFileAppender"
type="log4net.Appender.FileAppender">
    ...
    </appender>
    <root>
      <level value="DEBUG" />
      <appender-ref ref="NUnitFileAppender" />
      <appender-ref ref="NUnitConsoleAppender" />
    </root>
  </log4net>  
</configuration>

2. Verified that the file I created is being loaded in like so:

  Assert.AreEqual("unit.test",
System.Configuration.ConfigurationManager.AppSettings["config.type"]);

3. However, it looks like no appenders are actually loaded! When I run:

  IAppender[] appenders = LogManager.GetRepository().GetAppenders();
  System.Console.WriteLine("count of appenders: " + appenders.Count());

The system reports 0 appenders. Any ideas?

Thanks,
--Steve

Stephen Gross
QA Consultant
The New Guy

CONFIDENTIALITY NOTICE: Privileged or confidential information may be contained in this email
transmission (and any attachments accompanying it). The information is intended only for the
use of the intended recipient named above. If you are not the intended recipient, you are
hereby notified that any disclosure, copying, distribution or the taking of any action in
reliance on the contents of this emailed information, except its direct delivery to the intended
recipient named above, is strictly prohibited. If you have received this email in error, please
notify us immediately.


Mime
View raw message