ros2 / rcl_logging

Logging implementations for ROS 2.
Apache License 2.0
22 stars 35 forks source link

Spdlog rotate patch #103

Open cfveeden opened 1 year ago

cfveeden commented 1 year ago

Description

spdlog supports rotating loggers, but rcl_logging is not currently using them. This PR introduces the capability and puts the feature behind an envvar to preserve the original behaviour.

Details

The introduced ennvars and their defaults are: Envvar Default
RCL_LOGGING_SPDLOG_ROTATE_FILES False
RCL_LOGGING_SPDLOG_ROTATING_FILE_SIZE_BYTES 100MB
RCL_LOGGING_SPDLOG_MAX_NUM_FILES 5
cfveeden commented 1 year ago

@clalancette and @wjwwood is this change something that looks like it can be included?

cfveeden commented 11 months ago

@fujitatomoya spdlog does not have the functionality to be configured from files. It seems the recommended way to configure it is either to use spdlog_setup or re-implement the configuration logic. Which is preferred for ROS2?

fujitatomoya commented 11 months ago

@cfveeden i was thinking that we need to have something similar with https://github.com/guangie88/spdlog_setup in rcl_logging_spdlog. before starting implementation, maybe we can discuss on how to address this requirement in WG meeting probably Client WG? what do you think?

cfveeden commented 11 months ago

@fujitatomoya From the notes on the page the group is on hiatus and from the meeting minutes, I see the last meeting for that WG took place on 2023-01-18. Is it still active? If it is, it would be good to have the discussion and gather more requirements and insights from others.

For configuring spdlog, here are some pre-liminary options worth considering:

  1. Re-implement the parts that make sense inside rcl_logging_spdlog and add features as requests come in from the ROS2 community.
  2. Depend directly on spdlog_setup.
  3. Since there are some remaining open issues on spdlog_setup and the code frequency chart and commits shows that there hasn't been much recent activity, fork and maintain a ROS2 version of spdlog_setup and depend on that instead of re-implementing it.
fujitatomoya commented 11 months ago

I see the last meeting for that WG took place on 2023-01-18. Is it still active?

that i did not know 😓 @gbiggs @alsora Client WG is still active? or we should have this topic to somewhere else?

alsora commented 11 months ago

The client WG hasn't met in a few months. I think we can discuss this on Github

fujitatomoya commented 11 months ago

@cfveeden based on https://github.com/ros2/rcl_logging/pull/103#issuecomment-1874319169,

IMO,

Re-implement the parts that make sense inside rcl_logging_spdlog and add features as requests come in from the ROS2 community.

this looks reasonable for me. off the top of my head,

  1. what is the format configuration file, such as yaml?
  2. what elements should be supported in configuration file?
  3. deprecate the current environmental variable for spdlog, RCL_LOGGING_SPDLOG_EXPERIMENTAL_OLD_FLUSHING_BEHAVIOR.

maybe we can open the dedicated task issue for this and link all issues to it to track. unfortunately, i do not have bandwidth for this task right now, but i am happy to review and discuss details.

cfveeden commented 11 months ago

@fujitatomoya

  1. what is the format configuration file, such as yaml?
  2. what elements should be supported in configuration file?
  3. deprecate the current environmental variable for spdlog, RCL_LOGGING_SPDLOG_EXPERIMENTAL_OLD_FLUSHING_BEHAVIOR.

maybe we can open the dedicated task issue for this and link all issues to it to track. unfortunately, i do not have bandwidth for this task right now, but i am happy to review and discuss details.

  1. I think either toml or yaml will be adequate. I think most people have more familiarity with yaml since it is older and has been used extensively in ROS so that's what I suggest.
  2. If we are adding logging features one by one, this ticket would serve to add only the log rotation capability.
  3. Should this also be a separate PR? If not how will it be deprecated?

If you want to organise the effort under an initiative, I think #92 provides some of the things that we should aim for, especially the section under "For these reasons, I propose we make these changes:" in the OP's comment.

Other issues of interest for logging features would be #100, #105, #106.

fujitatomoya commented 11 months ago

I think https://github.com/ros2/rcl_logging/issues/92 provides some of the things that we should aim for, especially the section under "For these reasons, I propose we make these changes:" in the OP's comment.

agree, we can have the discussion on https://github.com/ros2/rcl_logging/issues/92