views:

161

answers:

1

Hi,

I have configured log4net in my app successfully but one thing is a little bit annoying for me. The log file is created (empty) after my app start even if no error occurs. I would like to log file be created only after some error.

Greetz!

+4  A: 

The problem with that approach is that then if the file exists but is read-only, or is in a directory which doesn't exist etc, you won't find out until another error is already causing problems. You really want to be confident that logging is working before the rest of the app starts.

There may be a way of doing this anyway, but if not I suspect that this is the reason.

Jon Skeet