vishwas-trivedi
vishwas-trivedi

Reputation: 594

Log4net rolling file has old modified and accessed timestamp

I'm using log4net's RollingFileAppender for logging, it is working as expected except for the fact the rolled over files's last modified or accessed date time are not updated even thought file is renamed with [filename.log].[number] extension(rolled over).

Please check this link. https://i.sstatic.net/2FMea.jpg

I have another module which collects updated log files every 2 hours, the problem is if last modified date time or accessed date time are not updated then I can not determine how to get updated log files.

I came across this issue : https://blogs.technet.microsoft.com/filecab/2006/11/07/disabling-last-access-time-in-windows-vista-to-improve-ntfs-performance/

but I do not want to enable NtfsDisableLastAccessUpdate as it will result in overall decrease in performance of OS.

Environment Details are as follows:

  1. OS : Windows server 2016
  2. Log4Net version : 2.0.8
  3. .Net version : 4.5

My question is :

  1. Is there any way to enable NtfsDisableLastAccessUpdate for a particular folder?
  2. Is there any way to override log4net's method(s) to update modified or accessed date time on every roll over event?

Upvotes: 2

Views: 167

Answers (1)

vishwas-trivedi
vishwas-trivedi

Reputation: 594

I'm answering my own question.

There is no other way. I had to modify the log4net library as per my requirements.

Upvotes: 1

Related Questions