Ron,
I got it this time! I need to figure out why it works
this time.
Thanks so much.
Ling
--- Ron Grabowski <[EMAIL PROTECTED]> wrote:
> If you setup a trace listener in your web.config
> file:
>
> <system.diagnostics>
> <trace autoflush="true">
> <listeners>
> <add
> name="textWriterTraceListener"
>
> type="System.Diagnostics.TextWriterTraceListener"
>
> initializeData="C:\\Inetpub\\wwwroot\\log4net.txt"
> />
> </listeners>
> </trace>
> </system.diagnostics>
>
> you'll be able to capture information sent through
> the diagnostic
> libraries:
>
> System.Diagnostics.Trace.Write("Hello World");
>
> Note that this is different than HttpContext's
> Trace:
>
> System.Web.HttpContext.Current.Trace.Write("Hello
> World");
>
> Log4net can be configured to write its internal
> debug messages to the
> diagnostics trace by adding a key to the appSettings
> node:
>
> <add key="log4net.Internal.Debug" value="true" />
>
> Your final web.config file will look something like
> this:
>
> <?xml version="1.0" encoding="utf-8" ?>
> <configuration>
> <configSections>
> <section
> name="log4net"
>
>
type="log4net.Config.Log4NetConfigurationSectionHandler,
> log4net"
> />
> </configSections>
> <appSettings>
> <add key="log4net.Internal.Debug" value="true" />
> </appSettings>
> <system.diagnostics>
> <trace autoflush="true">
> <listeners>
> <add
> name="textWriterTraceListener"
>
> type="System.Diagnostics.TextWriterTraceListener"
>
> initializeData="C:\\inetpub\\wwwroot\\log4net.txt"
> />
> </listeners>
> </trace>
> </system.diagnostics>
> <log4net>
> <appender
> name="FileAppender"
> type="log4net.Appender.FileAppender" >
> <file value="c:\\inetpub\\wwwroot\\log.txt" />
> <layout type="log4net.Layout.SimpleLayout" />
> </appender>
> <root>
> <level value="ALL" />
> <appender-ref ref="FileAppender" />
> </root>
> </log4net>
> </configuration>
>
> I would recommend putting a line in your
> Application_Start like this:
>
>
> System.Diagnostics.Trace.Write("Application_Start");
>
> to make sure the System.Diagnostics code was
> supplied with a valid file
> path.
>
> --- Ling Wang <[EMAIL PROTECTED]> wrote:
>
> > Tony,
> >
> > I tried StreamWriter for the folder and I can
> create
> > files and write text into it.
> >
> > Thanks.
> >
> > Ling
> >
> > --- Tony Wang <[EMAIL PROTECTED]> wrote:
> >
> > > Hi,
> > >
> > > It may be related to security. You have to set
> the
> > > log folder to be writable by the IIS user, this
> is
> > > The case at least in Win2K, and WinXP.
> > >
> > > Tony
>