Exceptions in log4net seems to be caught by "catch {}" or "catch
(Exception) {}" blocks (at least the recent check-ins are). Ignoring the
fact that you should probably only catch exceptions that the code might
generate, I'm more worried about forcefully killing threads in
multithreaded applications using log4net.

Since .NET don't have a way to forcefully kill a thread (afaik), the
only option you have is Thread.Abort() combined with a
ThreadAbortException handler. I had an elusive bug in a component I
wrote that turned out being caused by an "catch (Exception) {}" handler
that sometimes consumed a ThreadAbortException. Needless to say, this
was a Bad Thing(tm) and prevented the thread (and program) to terminate
correctly. There are better ways to stop threads of course, but since
abort is there and can/will be used, it should be handled correctly.

Regards,

Dag

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 14. februar 2005 11:41
To: [EMAIL PROTECTED]
Subject: cvs commit: logging-log4net/src/Config XmlConfigurator.cs

nicko       2005/02/14 02:40:46

  Modified:    src/Config XmlConfigurator.cs
  Log:
  Added DefaultCredential authentication support to loading config from
web request
  
  Revision  Changes    Path
  1.14      +13 -0     logging-log4net/src/Config/XmlConfigurator.cs
  
  Index: XmlConfigurator.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Config/XmlConfigurator.cs,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- XmlConfigurator.cs        14 Feb 2005 03:12:39 -0000      1.13
  +++ XmlConfigurator.cs        14 Feb 2005 10:40:46 -0000      1.14
  @@ -527,6 +527,7 @@
                                }
                                else
                                {
  +                                     // NETCF dose not support
WebClient
                                        WebRequest configRequest = null;
   
                                        try
  @@ -540,6 +541,17 @@
   
                                        if (configRequest != null)
                                        {
  +#if !NETCF
  +                                             // authentication may be
required, set client to use default credentials
  +                                             try
  +                                             {
  +
configRequest.Credentials = CredentialCache.DefaultCredentials;
  +                                             }
  +                                             catch
  +                                             {
  +                                                     // ignore
security exception
  +                                             }
  +#endif
                                                try
                                                {
                                                        WebResponse
response = configRequest.GetResponse();
  @@ -547,6 +559,7 @@
                                                        {
                                                                try
                                                                {
  +
// Open stream on config URI
 
using(Stream configStream = response.GetResponseStream())
 
{
 
Configure(repository, configStream);
  
  
  


Reply via email to