logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicko Cadell" <ni...@neoworks.com>
Subject RE: RollingFileAppender does not log to the file
Date Thu, 02 Dec 2004 12:51:46 GMT


> -----Original Message-----
> From: Marco Herrn [mailto:marco.herrn@sourcepark.org] 
> Sent: 02 December 2004 08:17
> To: Log4NET User
> Subject: Re: RollingFileAppender does not log to the file
> 
> > This is usually a permission related issue. The ASP.NET 
> worker process 
> > is running as the ASPNET use (by default) this account needs 
> > permission to create, modify, delete and list files in the 
> directory.
> 
> I will try to investigate this further, but it seems to me 
> that this should not be the case, since I use an 
> impersonation to let the process run as a specific user with 
> full rights.
> Could this be a different problem, too?

There are several different ways of impersonating which have different
effects:
Are you impersonating the calling web user? i.e.

<identity impersonate="true" />

Impersonating a specific user? i.e.

<identity impersonate="true" userName="MyUser" password="pass" />

Are you running the aspnet_wp.exe as another user? i.e.

<processModel userName="MyUser" password="pass" />


Also how are you configuring log4net? Are you using the
DOMConfiguratorAttribute or are you explicitly calling
DOMConfigurator.Configure()? If so where are you calling it? If you are
using the attribute then how are you getting your loggers? Are you
storing your loggers in a static field in each class?

If you are impersonating the calling web client then you will not be
impersonating when the web application starts, i.e. when the static
variables are resolved and the Application_Start event is raised.

If you are impersonating a specific user and you are using the
DOMConfiguratorAttribute and you are getting your logger and storing it
in a static member, say in your Global.asax.cs (extends
HttpApplication), then this may be running outside of the impersonation
context for the web application. You could try changing from using the
attribute to an explicit call to DOMConfigurator.Configure in the
Application_Start method.

Using <processModel> should work, but does affect all web applications
on the machine and typically this isn't what the user wants to do.

 
> > I am still slightly confused by the log4net-debug.txt trace 
> that you 
> > included in your first mail. The ASP.NET process doesn't typically 
> > have a console and the output of the console appender is discarded, 
> > just wondering how you captured the output of the internal log4net 
> > debug and console appender when run from ASP.NET?
> 
> Oh, sorry that I didn't mention that. I redirected Console 
> output by using System.Console.SetOut(StreamWriter) to catch 
> this output. In the same way I am catching the debug output 
> of log4net, otherwise I wouldn't get this, too.
 
While most of the internal debug goes to Console.Out the errors go to
Console.Error! If you want to capture the errors you need to use
Console.SetError() to redirect that as well. Doing this should allow you
to see what exception is being thrown when the file cannot be opened.

Cheers,
Nicko




Mime
View raw message