nicko       2004/03/12 11:12:55

  Modified:    src/Config XmlConfigurator.cs
  Log:
  Added better error message if the .net configuration section is not found.
  
  Revision  Changes    Path
  1.5       +11 -1     logging-log4net/src/Config/XmlConfigurator.cs
  
  Index: XmlConfigurator.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Config/XmlConfigurator.cs,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XmlConfigurator.cs        26 Feb 2004 21:02:57 -0000      1.4
  +++ XmlConfigurator.cs        12 Mar 2004 19:12:55 -0000      1.5
  @@ -100,7 +100,17 @@
   #else
                        try
                        {
  -                             ConfigureFromXml(repository, (XmlElement) 
System.Configuration.ConfigurationSettings.GetConfig("log4net"));
  +                             XmlElement configElement = 
System.Configuration.ConfigurationSettings.GetConfig("log4net") as XmlElement;
  +                             if (configElement == null)
  +                             {
  +                                     // Failed to load the xml config using 
configuration settings handler
  +                                     LogLog.Error("XmlConfigurator: Failed 
to find configuration section 'log4net' in the application's .config file. 
Check your .config file for the <log4net> and <configSections> elements.");
  +                             }
  +                             else
  +                             {
  +                                     // Configure using the xml loaded from 
the config file
  +                                     ConfigureFromXml(repository, 
configElement);
  +                             }
                        }
                        catch(System.Configuration.ConfigurationException 
confEx)
                        {
  
  
  

Reply via email to