Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.

Rolling files - Start log


We are using rolling files per day with max 7 days.

Is there any way to have the log files always starting with a specific log entry?

We want to log environmental data in our log like machine name, CPU, RAM etc. IF the application is running more than 7 days, you would loose that information, because it is only logged in the first file that now is deleted.


Hello Michael,

Thanks for your posting. There’s currently no built-in functionality for this, but you could look into implementing this yourself by detecting date changes in your application and then adding your special environment log entry. The easiest way to do this would be to write/use a small wrapper around the SmartInspect library which would be responsible for tracking/detecting the date changes and then adding the special log entry accordingly.

An alternative and simpler approach would be create a copy of the first log file as part of starting up your application (after logging the environment log entry).

I hope this helps and please let me know in case anything is unclear or if you have any further questions!