Dave, Out of interest what would happen if the AdoNetAppender could not connect to the database for some reason, lets say there is a network connectivity error? Does this change mean that the appender tries to connect each time a message is logged? Does this lead to a 30 second blocking timeout for each logging call that is routed to the appender?
If so this is likely an unexpected and unreasonable burden to place on the calling application. Nicko > -----Original Message----- > From: Dave Hutz [mailto:[EMAIL PROTECTED] > Sent: 24 January 2005 23:13 > To: [email protected] > Subject: ADONetAppender through a firewall > > We have been running into trouble while using ADONetAppender > to log to a database that is behind a firewall. > > In short, the firewall times-out idle connections, and > log4net doesn't reconnect to the database once the connection > is broken. > > I added some code like this, and it seems to fix the problem. > > /// <summary> > /// This method determines if there is a sense in attempting > to append. > /// </summary> > /// <remarks> > /// <para> > /// This method checks if the db is open. If it isn't, it opens it. > /// </para> > /// </remarks> > /// <returns><c>false</c> if any of the preconditions > fail.</returns> override protected bool PreAppendCheck() { > if (!base.PreAppendCheck()) > { > return false; > } > if (m_dbConnection==null || > m_dbConnection.State!=ConnectionState.Open) > { > InitialiseDatabaseConnection(); > InitialiseDatabaseCommand(); //must > reinitialize the command if we redo the connection > } > return true; //it throws above if it fails } > > > > Could you include this (or something like it) into the main code? > > Thanks, > Dave >
