logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From meisenstein <meisenst...@connectivityreport.com>
Subject Log4Net Error on DB Connect AdoNetAppender
Date Mon, 11 Jul 2011 13:42:25 GMT

I have my AdoNetAppender as code instead of as a XML config file, 
 log4net.Appender.AdoNetAppender adoAppender = new
log4net.Appender.AdoNetAppender();


I would like to catch an error if the database it's trying to connect to is
down, so that I can switch over to the file appender. This is where my
problem arises, Log4Net seems to consume the errors and echo the error to
the console instead of throwing it back again. I've wrapped my
AdoNetAppender in a try catch:

 
catch (Exception ex)
      {
        LoadFileAppender(level);
        Log log = new Log("AdoAdaptorFail");
        log.Error("AdoAdaptor Failed", "System", ex);
      }


to load the file appender and log the error, however ..it never comes here
because Log4Net consumes the error and writes it to the console...
Is there ANY WAY i can catch this configuration error to load the file
appender? 
Thanks

-- 
View this message in context: http://old.nabble.com/Log4Net-Error-on-DB-Connect-AdoNetAppender-tp32037558p32037558.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


Mime
View raw message