Thanks a lot
-----Original Message-----
From: Ron Grabowski [mailto:[EMAIL PROTECTED]]
Sent: Thursday, October 27, 2005 1:23 PM
To: Log4NET User
Subject: RE: internal debugging.
This page:
http://logging.apache.org/log4net/release/faq.html#internalDebug
says:
"
Internal debugging messages are written to the console and to the
System.Diagnostics.Trace system
"
Here's some sample code that adds a listener to the Trace system and
redirects messages to a file:
FileStream fileStream = new FileStream(
GetLog4NetLogFilePath(), FileMode.Create, FileAccess.Write );
if (fileStream != null && fileStream.CanWrite)
{
System.Diagnostics.Trace.Listeners.Clear();
System.Diagnostics.Trace.Listeners.Add(
new TextWriterTraceListener(fileStream));
}
log4net.Config.XmlConfigurator.Configure();
System.Diagnostics.Trace.Flush();
I think its easier to define this in the application config file so you
can easily turn it on or off or change the output file name without
recompiling:
<system.diagnostics>
<trace autoflush="true">
<listeners>
<add name="textWriterTraceListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="C:\\Inetpub\\wwwroot\\Logs\\log4net.txt" />
</listeners>
</trace>
</system.diagnostics>
--- Ramaa Davanagere <[EMAIL PROTECTED]> wrote:
>
>
> All the setting to enable log4net internal debugging should be done
> via
> code. No config files are allowed.
>
>
>
> -----Original Message-----
> From: Ramaa Davanagere
> Sent: Thursday, October 27, 2005 12:59 PM
> To: '[email protected]'
> Subject: internal debugging.
>
>
>
> Is this how I enable internal debugging via code?
>
>
>
> log4net.Util.LogLog.InternalDebugging = true;
>
>
>
> Also, where are these log messages written to? Is it written to text
> file
> and where is this file located?
>
> If not, how can I set it up to write all the messages to text file?
>
>
>
> Finally, is this quote true?
>
>
>
> "Log4net is designed to not throw exceptions. Your application should
> continue to work even if there is something wrong with log4net."
>
>
>
> Thanks.
>
>
