Joe, The appender should be opening the connection before using it. Can you enable log4net internal debug and get a trace of log4net initialising the appender and attempting to log? http://logging.apache.org/log4net/release/faq.html#internalDebug
Using <appSettings> <add key="log4net.Internal.Debug" value="true"/> is preferable to the <log4net debug="true"> syntax because it enables internal logging earlier. Cheers, Nicko > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: 08 June 2005 19:46 > To: [email protected] > Subject: AdoNetAppender wierdness > > > First let me give some background info, then I will describe > my issue... > > 1. VS.NET 2003 > 2. .NET runtime 1.1 > 3. Log4Net version 1.2.9 > 4. Windows Form application. uses log4net.dll debug version. > 5. Connecting to Oracle 9i database > > I am trying to set up log4net to log to an AdoNetAppender for > Oracle 9i. When I went to test, I could not get any log > messages to write to the database. I verified that the > output from the logger initialization was not throwing any > log4net errors. So to ensure that I was connecting ok to the > database, I put in a simple call to the same database I am > trying to log messages to (i.e. con.Open(), cmd.Execute, > con.Close()). Amazingly, once I added this call, the logging > worked. But when I comment out again, the logging stopped > working again. So it almost looks to me like it needs me to > open a connection to the database before I ever start logging > to it, even though the connection string for the log4net > configuration is different than the one used for the simple > sql test. Shouldn't the AdoNetAppender open the connection > using it's settings up front...or am I missing something in > the documentation? I included my App.config log4net > configuration section > > <configSections> > <section name="log4net" > type="log4net.Config.Log4NetConfigurationSectionHandler, > log4net" /> </configSections> <log4net debug="true"> > <appender name="OracleAppender" > type="log4net.Appender.AdoNetAppender"> > <connectionType > value="System.Data.OracleClient.OracleConnection, > System.Data.OracleClient, Version=1.0.5000.0, > Culture=neutral, publicKeyToken=b77a5c561934e089" /> > <connectionString value="Data > Source=NEON1T1;Integrated Security=false;User > ID=bodb_user;Password=b0dbus3r;Max Pool Size=5" /> > <commandText value="insert into BODB.BACK_OFFICE_LOG > (BOL_DATE,BOL_LEVEL,BOL_MESSAGE) VALUES > (:log_date,:log_level,:message)" /> > <bufferSize value="128" /> > <parameter> > <parameterName value=":log_date" /> > <dbType value="DateTime" /> > <layout type="log4net.Layout.RawTimeStampLayout" /> > </parameter> > <parameter> > <parameterName value=":log_level" /> > <dbType value="String" /> > <size value="25" /> > <layout type="log4net.Layout.PatternLayout"> > <conversionPattern value="%level" /> > </layout> > </parameter> > <parameter> > <parameterName value=":message" /> > <dbType value="String" /> > <size value="4000" /> > <layout type="log4net.Layout.PatternLayout"> > <conversionPattern value="%message" /> > </layout> > </parameter> > </appender> > <root> > <level value="INFO" /> > <appender-ref ref="OracleAppender" /> > </root> > </log4net> > > Joe Gray > > > This transmission may contain information that is privileged, > confidential and/or exempt from disclosure under applicable > law. If you are not the intended recipient, you are hereby > notified that any disclosure, copying, distribution, or use > of the information contained herein (including any reliance > thereon) is STRICTLY PROHIBITED. If you received this > transmission in error, please immediately contact the sender > and destroy the material in its entirety, whether in > electronic or hard copy format. Thank you. > >
