ASP .Net multiple Application Pools, and log file locking

Cantor, Scott cantor.2 at osu.edu
Thu Aug 6 11:45:25 EDT 2015


On 8/6/15, 5:18 AM, "dev on behalf of Martin Robinson" <dev-bounces at shibboleth.net on behalf of martin.robinson at dai.co.uk> wrote:



>To add whatever is necessary to log4shib and isapi_shib.dll so that the log file handles are closed while that IIS process is idle, between http requests?

You're welcome to file a bug (you can use the SP project for that, I don't have a log4shib project set up in Jira since the code is predominantly not mine to begin with).

>Doesn't sound like a big ask really.

I think you are underestimating the work involved, and I think you have no idea how few resources are available to work on it.

>Could be done simply by defining a new log appender class, derived from RollingFileAppender, but that opens and closes the file for each append. That might be too much of a performance overhead.
> It would be better to open the log file(s) once at beginning of each ISAPI event, handle the event (logging as much or as little as required) then close the log file(s).

Those are effectively the same thing (and I'm not sure that the latter is even possible). With what little I recall of the code, I would guess that the threads will collide trying to open the same file for output, so they'd be single-threading through the process around a mutex, and the bottleneck would be very bad.

>Keeping open files handles for long periods is a BAD THING as it also prevents you clearing up log files manually.

You're free to complain to the log4cpp project. For myself, I had to make do with what I had. If you think portable C++-friendly, thread-safe logging libraries grow on trees, try and find one. I had to make it thread-safe and deal with constant portability problems myself, which is why I forked it.

> I needed to restart IIS on a production server to clear out a 500MB log file that I found to be growing rather quickly.

There is really no reason the file should be growing that quickly, hardly anything gets logged to it if DEBUG isn't on. In particular, I don't believe anything actually gets logged to it on a per-transaction or even per-session basis. I could be misremembering. It may well be the more practical fix to adjust the logging level it's using for something that may not be that important, or adjust a category so it can be selectively controlled.

-- Scott



More information about the dev mailing list