fjpanag opened a new pull request #3842:
URL: https://github.com/apache/incubator-nuttx/pull/3842


   ## Summary
   Automatic log rotation mechanism.
   
   When a log file is opened, its size is checked. If it is found larger than 
the specified limit, it is rotated automatically.  
   This feature is very useful in file loggers so a) the log file does not get 
excessively large, b) the physical memory does not get exhausted due to log 
files.
   
   This implementation tries to be as lightweight as possible:
   
   - The log file is only checked during opening, so there is no additional 
overhead during normal logging.
   - The existing log file is kept as a backup, and a new empty file is created 
for logging. This approach is very fast and simple compared to actually 
manipulating the contents of the log file (in order to shrink it).
   
   Limitations / Assumptions
   
   - Since the file is only checked during opening, the log file can (and will 
!) exceed the limit. The file system must have enough space available to allow 
for this "overflow", till next check.
   - It is assumed that re-opening of the log file will happen occasionally. 
Either by any system reset, or by (un)mounting of the file system. 
   
   Regardless of the above limitations, I have tested the this exact mechanism 
in other applications, and I found it to work nicely. In real-life applications 
I wouldn't expect the above limitations to be met. 
   
   ## Impact
   None on existing configurations.
   
   ## Testing
   Pending. I will comment bellow when ready.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to