-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add documentation about setting logger's severity from file #2000
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: rolling
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 has 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 | ||
Comment on lines
+213
to
+217
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this actually yaml format that code-block mentions? probably we would want to use format that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, this's not a YAML file, I used that one just for highlighting the values |
||
|
||
.. 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 | ||
^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
Uh oh!
There was an error while loading. Please reload this page.