Skip to content

DVR-203: Implement logging

Hosseini requested to merge DVR-203-Implement-Application-logging into master

switch to syslog-style rotation with crash-safe handling Replace the previous round-robin log0/log1/log2 rotation with a rotation scheme matching BusyBox syslogd behavior. The active log file is now always "/data/log/apps/log". When the file exceeds the size limit, it is renamed to "log.0", and the previous backups are shifted upward up to a maximum of 5 rotated logs.

This ensures predictable log ordering and prevents recently written logs from being overwritten prematurely.

Additional improvements:

  • Use fcntl byte-range locking to serialize writes and rotations
  • Reopen the log file at most once per second to allow external removal
  • Perform directory fsync after rename/unlink to provide crash safety
  • Use full_write helper to avoid partial write losses
  • Ensure active log file is unlinked after rotation to prevent hardlink edge cases observed in failure scenarios

Merge request reports

Loading