OdbDesign icon indicating copy to clipboard operation
OdbDesign copied to clipboard

Add log file size limitation

Open wen2so opened this issue 6 months ago • 3 comments

The size of the log file should be restricted

wen2so avatar Jul 09 '25 01:07 wen2so

Did it grow too large on your system?

nam20485 avatar Jul 10 '25 22:07 nam20485

Did it grow too large on your system?

If run as a service for a long time, it will generate very large log files; currently, there is no code seen to limit the size/number of log files; we can try optimizing by splitting files and limiting the number of log files;

wen2so avatar Jul 11 '25 03:07 wen2so

Makes sense. I usually use a "rolling" log approach similar to below...

I'd probably add another feature to allow keeping log files around longer by compressing old log files using zip. Zipping functionality already exists in the codebase. Because text, we would see very high compression ratios. This would cover scenarios where keeping logs for x amount of time is required for mandatory compliance reasons. This feature would be a "nice to have" compared to the main issue.

// Two settings
int numLogsToKeep 4;    // 4 * 5MB log files by default
int maxLogSizeinBytes = 5*1024*1000*1000;  // 5 MB default
...

Log.writeMessage(...)
{
  ...
  if (currlogFileSize > maxLogSizeInBytes)
  {
    reconcileLogFiles();
    ...
  }
}

// etc.

nam20485 avatar Jul 13 '25 16:07 nam20485