Skip to content

Make logging logrotate friendly #833

@bctrainers

Description

@bctrainers

This issue pertains to this segment of main.cc: https://github.com/robotastic/trunk-recorder/blob/b3036159b513d1a0bbe3c456b23c1ed4f93df5c4/trunk-recorder/main.cc#L167-L174

The addition of a toggled global option within the config file to make logging friendly to logrotate syslog-styled logs. The option within the config.json would be a global option called syslogFriendly as a boolean.

What would this request do exactly? If syslogFriendly is set to true, a new function would be utilized within the segment of code above.

  1. The file_name directive would become trunk-recorder.log while respecting config.log_dir and config.log_file string and boolean respectively.
  2. The log would have no date-time prefix due to # 1 (ex; 07-09-2023_0516_00.log).
  3. No built-in log rotation would occur. That would be on logrotate to truncate the current log file.
  4. TrunkRecorder must check for file existence when writing to trunk-recorder.log - as such, SIGHUP or another signal would need to be used and captured on Trunk-Recorders' end.

This code addition would likely require the addition of text_file_backend::rotate_file() from boost when a signal is utilized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions