From ef9bebe726c2a1eefd16c960cd09ba3324c76c1e Mon Sep 17 00:00:00 2001 From: JafarAbdi Date: Wed, 6 Oct 2021 19:53:36 +0300 Subject: [PATCH 1/3] Add documentation about setting logger's severity from file --- .../Logging-and-logger-configuration.rst | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/source/Tutorials/Logging-and-logger-configuration.rst b/source/Tutorials/Logging-and-logger-configuration.rst index db2a483196b..a6737eaf586 100644 --- a/source/Tutorials/Logging-and-logger-configuration.rst +++ b/source/Tutorials/Logging-and-logger-configuration.rst @@ -181,6 +181,62 @@ Restart the demo including the following command line arguments: ros2 run logging_demo logging_demo_main --ros-args --log-level logger_usage_demo:=debug +Logger level configuration: configuration file +-------------------------------------------- + +The severity level for loggers could be set in a configuration file and setting environment variable ``RCUTILS_LOGGING_CONFIG_FILE`` to point to the file path + +.. tabs:: + + .. group-tab:: Linux + + .. code-block:: bash + + export RCUTILS_LOGGING_CONFIG_FILE="path_to_config_file" + + .. group-tab:: macOS + + .. code-block:: bash + + export RCUTILS_LOGGING_CONFIG_FILE="path_to_config_file" + + .. group-tab:: Windows + + .. code-block:: bash + + # set "RCUTILS_LOGGING_CONFIG_FILE=path_to_config_file" + +The config file have the following structure + +.. code-block:: YAML + + # This is a comment + logger1_name=severity # severity could fatal/error/debug/info/warn case-insensitive + logger2.child_logger=debug # Another comment + # This is a special name used to set the default logger level + default_logger_level=info + +.. note:: + + The command line severity level prevails the one from the ``RCUTILS_LOGGING_CONFIG_FILE``, for example having the following configuration file + + .. code-block:: YAML + + default_logger_level=info + logger_usage_demo=error + + Running the following command will set the default logger level to ``debug`` not ``info`` + + .. code-block:: bash + + ros2 run logging_demo logging_demo_main --ros-args --log-level debug + + Same here logger_usage_demo's level will be ``debug`` rather than ``error`` + + .. code-block:: bash + + ros2 run logging_demo logging_demo_main --ros-args --log-level logger_usage_demo:=debug + Console output formatting ^^^^^^^^^^^^^^^^^^^^^^^^^ From 8447c220565230f5dc342ba134bc16babf6f183d Mon Sep 17 00:00:00 2001 From: Jafar Abdi Date: Wed, 6 Oct 2021 20:35:09 +0300 Subject: [PATCH 2/3] Update source/Tutorials/Logging-and-logger-configuration.rst Co-authored-by: Abrar Rahman Protyasha --- source/Tutorials/Logging-and-logger-configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Tutorials/Logging-and-logger-configuration.rst b/source/Tutorials/Logging-and-logger-configuration.rst index a6737eaf586..16f99a41e32 100644 --- a/source/Tutorials/Logging-and-logger-configuration.rst +++ b/source/Tutorials/Logging-and-logger-configuration.rst @@ -184,7 +184,7 @@ Restart the demo including the following command line arguments: Logger level configuration: configuration file -------------------------------------------- -The severity level for loggers could be set in a configuration file and setting environment variable ``RCUTILS_LOGGING_CONFIG_FILE`` to point to the file path +The severity level for loggers could be set in a configuration file and setting environment variable ``RCUTILS_LOGGING_CONFIG_FILE`` to point to the file path. .. tabs:: From b6f4403842a4aba4bca324460e28b6249c8476c9 Mon Sep 17 00:00:00 2001 From: Jafar Abdi Date: Wed, 6 Oct 2021 20:35:47 +0300 Subject: [PATCH 3/3] Update source/Tutorials/Logging-and-logger-configuration.rst --- source/Tutorials/Logging-and-logger-configuration.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Tutorials/Logging-and-logger-configuration.rst b/source/Tutorials/Logging-and-logger-configuration.rst index 16f99a41e32..6e0076ac53e 100644 --- a/source/Tutorials/Logging-and-logger-configuration.rst +++ b/source/Tutorials/Logging-and-logger-configuration.rst @@ -206,7 +206,7 @@ The severity level for loggers could be set in a configuration file and setting # set "RCUTILS_LOGGING_CONFIG_FILE=path_to_config_file" -The config file have the following structure +The config file has the following structure. .. code-block:: YAML