logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <piers.willi...@gmail.com>
Subject RE: unintended usage of the same configuration file
Date Sun, 11 Oct 2015 14:27:44 GMT
Dominic: I’m afraid I don’t agree with any of what you said. File based logging is a critical
part of any instrumentation strategy – it’s way faster than logging to a (typically remote)
database, and gives you somewhere to log the errors when the database is down. That’s assuming
you have a database at all of course – not all web applications even have one (though I’d
concede that’s rare).

It’s true that web applications will typically have limited write access to local disks,
and that’s entirely appropriate, but they always have some write permissions somewhere –
even if it’s only to Temp. Establishing a location with write permissions for logs hardly
entails ‘punching holes in permissions’.

Finally, as best I can tell, none of this is relevant to the OP’s actual issue, which would
be just the same whether he was logging to file or to database, because it’s a configuration

From: Dominik Psenner
Sent: Sunday, 11 October 2015 2:35 PM
To: Log4NET User
Subject: Re: unintended usage of the same configuration file

The concept behind how web applications work makes it hard to use file appenders. A web application
should not access a filesystem directly and punching holes into permissions may not be advisable.
If i had to work out a web app i would log to the database that the web application will require
On 11 Oct 2015 4:26 a.m., "tasos" <tasoss@gmail.com> wrote:
I'm working on a .net application and i have used this guidance http://haacked.com/archive/2005/03/07/ConfiguringLog4NetForWebApplications.aspx/
There is a project on which i have added in the assemblyinfo.cs
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "foo1.config", Watch = true)]
and in another one(different assembly)
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "foo2.config", Watch = true)]
My configurations are like this http://pastebin.com/UpSpwMHH
except the different output filenames
(<param name="File" value="foofilename.log"/> )
The problem is that the assembly that uses foo1.config writes on the output
file of the file that is configured in foo2.config.
In each class i use log4net i declare as the guidance site(mentioned above) says:
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

Thank you in advance for your help!

View raw message