Did you ever watch debug output in Visual Studio? In my experience an
ADONetAppender is unable to correctly close on program shutdown and
these exceptions are written to debug output.

I have found a simple solution: to call LogManager.Shutdown on program exit.
---------
Prostredi: VB.NET, VS2005 Pro, XP Pro/P4 3GHz, 2GB RAM
___________________________________________________
Karel Kral, vyvojar
ANETE, s.r.o.
___________________________________________________

On 11.1.2007 20:17, Cheng wrote:
> does any one experience of loss log entries when using AdoNetAppender?
> 
> I have both RollingFileAppender and AdoNetAppender in one of my
> application. From time to time, there were some of log entries missing
> in the database but they were in the log file. The bufferSize is set to 1.
> 
> On 1/8/07, *bolikdimon* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> wrote:
> 
> 
>     I found better way of doing this:
>     Here is my config file:
>           <parameter>
>             <parameterName value="@ProcessID" />
>             <dbType value="Int64" />
>             <layout type=" log4net.Layout.RawPropertyLayout" >
>               <key value="ProcessID" />
>             </layout>
>           </parameter>
> 
>     It works !
> 
> 
> 
>     Stephen Murtagh wrote:
>     >
>     > I had a similar problem about a year back, ended up subclassing
>     > AdoNetAppenderParameter and overriding the FormatValue method as
>     below:
>     >
>     >  public class MyAdoNetAppenderParameter : AdoNetAppenderParameter
>     >  {
>     >   /// <summary>
>     >   /// Custom version of FormatValue method which also converts
>     NullText
>     >   value (null) to DBNull
>     >   /// </summary>
>     >   /// <param name="command"></param>
>     >   /// <param name="loggingEvent"></param>
>     >   public override void FormatValue(System.Data.IDbCommand command,
>     >   log4net.Core.LoggingEvent loggingEvent)
>     >   {
>     >    // Lookup the parameter
>     >    IDbDataParameter param =
>     >    (IDbDataParameter)command.Parameters[ParameterName];
>     >
>     >    // Format the value
>     >    object formattedValue = Layout.Format(loggingEvent);
>     >
>     >    // If the value is null then convert to a DBNull
>     >    if ((formattedValue == null) || (formattedValue.ToString() ==
>     >    SystemInfo.NullText))
>     >    {
>     >     formattedValue = DBNull.Value;
>     >    }
>     >
>     >    param.Value = formattedValue;
>     >   }
>     >  }
>     >
>     > This can be intergrated with any other changes to your existing
>     logging
>     > code and only one minor change to the config file - set the type
>     of the
>     > parameter to that of your new class above.
>     >
>     > Hope this helps.
>     >
>     > Is there a better or recommended way of doing this?
>     >
>     >
>     > -----bolikdimon <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
>     wrote: -----
>     >
>     >
>     > To: [email protected]
>     <mailto:[email protected]>
>     > From: bolikdimon <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
>     > Date: 01/08/2007 01:02PM
>     > Subject: AdoNetAppender problem.
>     >
>     >
>     > Hello. Help me please.
>     > I'm using AdoNetAppender. How can I pass NULL value into stored
>     procedure
>     > ?
>     > Here is my code:
>     >             ...
>     >            ThreadContext.Properties["ProcessID"] = DbNull.Value;
>     >            log.Debug(message);
>     >
>     > Config-file:
>     >      <parameter>
>     >        <parameterName value="@ProcessID" />
>     >        <dbType value="Int64" />
>     >        <layout type="log4net.Layout.PatternLayout"
>     value="%X{ProcessID}"
>     > />
>     >      </parameter>
>     >
>     > What's wrong ?
>     >
>     > --
>     > View this message in context:
>     > http://www.nabble.com/AdoNetAppender-problem.-tf2939176.html#a8217407
>     > Sent from the Log4net - Users mailing list archive at Nabble.com
>     <http://Nabble.com>.
>     >
>     >
>     >
>     >
>     
> *********************************************************************************
>     >
>     > Disclaimer: This electronic mail, together with any attachments,
>     is for
>     > the exclusive and confidential use of the recipient addressee. Any
>     other
>     > distribution, use or reproduction without our prior consent is
>     > unauthorised and strictly prohibited. If you have received this
>     message in
>     > error, please delete it immediately and contact the sender
>     directly or the
>     > Robert Wiseman & Sons Ltd IT Helpdesk on +44 (0)1355 270634. Any
>     views or
>     > opinions expressed in this message are those of the author and do not
>     > necessarily represent those of Robert Wiseman & Sons Ltd or of any
>     of its
>     > associated companies. No reliance may be placed on this message
>     without
>     > written confirmation from an authorised representative of the company.
>     >
>     > Robert Wiseman & Sons Limited reserves the right to monitor all e-mail
>     > communications through its network.
>     >
>     > This message has been checked for viruses but the recipient is
>     strongly
>     > advised to re-scan the message before opening any attachments or
>     attached
>     > executable files.
>     >
>     >
>     
> ********************************************************************************
> 
>     >
>     >
>     >
> 
>     --
>     View this message in context:
>     http://www.nabble.com/AdoNetAppender-problem.-tf2939176.html#a8223361
>     Sent from the Log4net - Users mailing list archive at Nabble.com
>     <http://Nabble.com>.
> 
> 

Reply via email to