Is it possible one log file and one error handler for a set of web services?
We have a set of web services which is also our internal API. They share one common web.config file perfectly.
Is there a way somehow to make log4net create one log for the entire site, for all? And is there a generic error handler? The problem, I think it is all separate virtual directories, separate applications ...?
But then again ... they have the same web.config file and it works great ... can it somehow share global.asax or something? Can't get it to work ...
Thanks for any help.
source to share
From the log4net FAQ :
How do I get multiple registration process to the same file?
By default, FileAppender holds an exclusive write lock to the log file while it is being logged. This prevents other processes from writing to the file. FileAppender can be configured to use a different locking model, MinimalLock, which only acquires the write lock when the log is written. This allows processes to interleave records in the same file, albeit with loss of representation. See FileAppender configuration examples for an example MinimalLock configuration.
Although the MinimalLock model can be used to interleave records into a single file, it may not be an optimal solution, especially when registering multiple machines. Alternatively, you can have one or more processes for RemotingAppenders. Using the RemoteLoggingServerPlugin (or IRemoteLoggingSink), a process can receive all events and write them to one log file.
With no additional configuration, log4net places an exclusive lock on the file. Using their MinimalLock setting, you can "hope" to get a general log. In other words, your mileage may vary.
As a suggested alternative strategy, since you have an internal API with web services, consider a web service method that implements a single private static logger in the background and adds entries to the log. You can call the web logging method (asynchronously if performance is critical) from other web methods where you want to implement logging.
source to share