I have started using EventSentry to monitor a log file produced via Log4Net called Service.log. The monitoring is working & has returned alerts as per my settings.
The log file is configured to not grow more than 50MB. When it reaches this size Log4Net renames the current log file to Service.log.x, where x is replaced with a number. It then creates a new file called Service.log & starts logging to it.
This process has been working well for years. However since I started using EventSentry to monitor the file, the rename process is not working. Instead the 50MB log file seems to disappear, & a new Service.log file is created.
Has anyone seen this behaviour before? Are there any EventSentry settings I can changes that might stop this from happening?
Hi Derek,
Thanks for using EventSentry.
Since EventSentry is monitoring log files in real time (it does not poll them), I believe it has some read-only handles open to the monitored file(s). I'm not sure how this would interfere with log4net, since our monitoring is obviously passive - we're not locking the file in any way.
Now, this feature has been around for a few years, and this is the first report I have seen that mentions a problem like this. There are no settings you can change, but there are a few things we can try to get to the bottom of this:
1. Just to be sure, are you using the latest version of log4net?
2. Have you tried to contact log4net's support forum/mailing list to see if this is known issue? Does log4net provide a log file?
3. You could monitor the monitoring process with Process Monitor, it might indicate why the rename is failing.
4. Is this something that we can try to reproduce on our end here? We'd be happy to try and reproduce this.
I hope this helps.
Thanks Ingmar. In this case I have determined a reasonable workaround. Rather than use a log file that always has the same name, I have now configured Log4Net to create a new file each day with the date appended. This appears to be working fine.
It looks like you're new here. If you want to get involved, click one of these buttons!