Today debug format looks something like this:

void DebugFormat(string input, params object[] args)
{
    if (IsDebugEnabled)
    {
       log(string.Format(input, args));
    }
}

Quick solution (but not very smart) :)

void DebugFormat(string input, params object[] args)
{
    if (IsDebugEnabled)
    {
       try { log(string.Format(input, args)); }
       catch { }
    }
}



Best Regards
Morten Andersen
Developer
Vianett AS | [EMAIL PROTECTED] | Office: +47 69 20 69 74 | Skype: mortander



Ron Grabowski wrote:
Log4net doesn't have its own run-time parsing engine for the *Format
methods; it just calls through to String.Format. If the format string
and parameters you're generating aren't compatible with String.Format
then you'll get unexpected results. For example, this will not include
"Morten" in the message:

 log.DebugFormat("Hello! Where is?, "Morten");

If you think that DebugFormat will cause problems, I recommend using
just the normal Debug method. 

Perhaps the documentation could be improved to highlight this.

--- Morten Andersen <[EMAIL PROTECTED]> wrote:

  
Hi!

log.DebugFormat("Hello {0}! Where is {1}?, "Morten");

I know that I am missing an argument. The problem here is that some
of 
my applications went down because of this.

-- 

Best Regards
*Morten Andersen*
Developer
Vianett AS <http://www.vianett.no/> | [EMAIL PROTECTED] 
<mailto:[EMAIL PROTECTED]> | Office: +47 69 20 69 74 
<callto://+4769206974> | Skype: mortander <callto://mortander>


    

  

Reply via email to