The faq.html page has the sentance "Internal debugging messages are
written to the console and to the System.Diagnostics.Trace system." If
you want to capture log4net's debug message and redirect them to a
file, create a file stream for log4net.txt and attach it to
System.Diagnostics.Trace. Omitting error checking, its only two lines
of code to capture the output:
FileStream fileStream = new FileStream("log4net.txt", FileMode.Create,
FileAccess.Write);
System.Diagnostics.Trace.Listeners.Add(new
TextWriterTraceListener(fileStream));
before you initialize log4net:
// v1.2.0. beta 8
log4net.Config.DOMConfigurator.Configure();
Inside log4net.txt, you'll see all of log4net's debug messages:
log4net: DOMConfigurator: loading XML configuration
log4net: DOMConfigurator: Configuring Repository
[log4net-default-domain]
log4net: DOMConfigurator: Configuration update mode [Merge].
log4net: DOMConfigurator: Logger [root] Level string is [ALL].
...
I posted code to the list a while ago showing how an ASP.Net
application can capture debug output and send it to named file:
<appSettings>
<add key="log4net.Internal.Debug" value="true" />
<add key="log4net.StartupLogfileName" value="~/Logs/log4net.txt" />
</appSettings>
--- Owen Corpening <[EMAIL PROTECTED]> wrote:
> that was it! Unfortunately still no output, guess I have to redirect
> stdout
> or whatever ... there are instructions in the internal debugging page
> ...
> sure is complicated
>
> owen
>
> "Ron Grabowski" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > This is the correct class:
> >
> > log4net.Util.LogLog.InternalDebugging = true;
> >
> >
> > --- Owen Corpening <[EMAIL PROTECTED]> wrote:
> > > "To enable log4net's internal debug programmatically you need to
> set
> > > the
> > > log4net.helpers.LogLog.InternalDebugging property to true. "
> > >
> > > How do I do that from my C# code, say right before I try to
> configure
> > > the
> > > file? feeling a little lost - maybe just point me the way to go
> this
> > > once
> > > and I will catch on ...
> > >
> > > "Nicko Cadell" <[EMAIL PROTECTED]> wrote in message
> > >
> news:[EMAIL PROTECTED]
> > > Can you try enabling internal debugging to see if an error is
> being
> > > generated?
> > >
> > > http://logging.apache.org/log4net/release/faq.html#internalDebug
> > >
> > >
> > > Nicko
> > >
> > >
> > > > -----Original Message-----
> > > > From: news [mailto:[EMAIL PROTECTED] On Behalf Of Owen
> Corpening
> > > > Sent: 11 May 2005 00:11
> > > > To: [email protected]
> > > > Subject: not getting a log file
> > > >
> > > > This file /tmp/owen.config (I added everyone full-control to
> > > > /tmp) is used:
> > > >
> > > > <?xml version="1.0" encoding="utf-8" ?>
> > > > <log4net>
> > > > <appender name="FileAppender"
> > > > type="log4net.Appender.FileAppender">
> > > > <file value="c:\\tmp\\log.txt" />
> > > > <layout type="log4net.Layout.PatternLayout,log4net">
> > > > <conversionPattern value="%5p %d (%c:%L) - %m%n" />
> > > > </layout>
> > > > </appender>
> > > > <root>
> > > > <level value="ALL" />
> > > > <appender-ref ref="FileAppender" />
> > > > </root>
> > > > </log4net>
> > > >
> > > >
> > > > using System.IO;
> > > > using System.Configuration;
> > > > using log4net;
> > > > using log4net.Config;
> > > > [assembly: log4net.Config.XmlConfigurator()] namespace
> ManagedDLL {
> > > > // Interface declaration.
> > > > public interface IConfigureActuateXml
> > > > {
> > > > int Edit(string filename);
> > > > };
> > > > // Interface implementation.
> > > > public class ManagedClass:IConfigureActuateXml
> > > > {
> > > > private static readonly ILog log =
> > > > LogManager.GetLogger("ManagedClass");
> > > > public int Edit(string filename)
> > > > {
> > > >
> log4net.Config.XmlConfigurator.ConfigureAndWatch(new
> > > >
> > > > System.IO.FileInfo(AppDomain.CurrentDomain.SetupInformation.Ap
> > > > plicationBase
> > > > + "/tmp/owen.config"));
> > > > log.Info("In Edit, filename = " + filename);
> > > > return 1;
> > > > }
> > > > }
> > > > }
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> >
>
>
>
>