This repository contains several packages which are all related to the ROS logging functionalities.
- rcl_logging_interface
- rcl_logging_noop
- rcl_logging_spdlog
Logging implementations for ROS 2.
License: Apache License 2.0
There are two kind of vendor packages in ROS 2.
My question here is should we try to get rid off the second find_package
or don't we mind the find the library twice ?
Here you can find an example what I mean with "find the library twice":
find_package(spdlog_vendor REQUIRED) # Provides spdlog 1.3.1 on platforms without it.
find_package(spdlog REQUIRED)
This question is extensible to poco, yaml, yaml-cpp and the other vendor packages.
@wjwwood and @dirk-thomas what do you think?
I read https://docs.ros.org/en/foxy/Tutorials/Demos/Logging-and-logger-configuration.html#console-output-formatting but it doesn't mention how to specify the datetime format to be something else than seconds, is that possible?
I have a bit an unusual setup. I have a django daphne server which I start over supervisor like so: command=/bin/bash -c 'source "$0" && exec "$@"' /home/usr/ros2_foxy/install/setup.bash /home/usr/app/bin/daphne -t 30 --access-log - --proxy-headers web.asgi:application
. I have a small client which controls my ros node using pythons ros2lifecycle.api and ros2param.api. For this I need to create a node to be able to use these apis. Now my client works if run from a normal python file:
rclpy.init()
client = Client()
but when running these same two lines inside of a django view I get following error stack trace:
>>> [rcutils|error_handling.c:108] rcutils_set_error_state()
This error state is being overwritten:
'rcutils_expand_user failed, at /home/usr/ros2_foxy/src/ros2/rcl_logging/rcl_logging_interface/src/logging_dir.c:81'
with this new error message:
'Failed to get logging directory, at /home/usr/ros2_foxy/src/ros2/rcl_logging/rcl_logging_spdlog/src/rcl_logging_spdlog.cpp:84'
rcutils_reset_error() should be called after error handling to avoid this.
<<<
Traceback (most recent call last):
File "/home/usr/PycharmProjects/myapp-app/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/home/usr/PycharmProjects/myapp-app/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/usr/PycharmProjects/myapp-app/lib/python3.8/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/usr/PycharmProjects/myapp-app/myapp-ui/myapp_ui/myapp_web/myapp/views.py", line 51, in start_something
start_something()
File "/home/usr/PycharmProjects/myapp-app/myapp-ui/myapp_ui/myapp_web/myapp/views.py", line 227, in stop_something
rclpy.init()
File "/home/usr/ros2_foxy/install/rclpy/lib/python3.8/site-packages/rclpy/__init__.py", line 76, in init
return context.init(args, domain_id=domain_id)
File "/home/usr/ros2_foxy/install/rclpy/lib/python3.8/site-packages/rclpy/context.py", line 76, in init
rclpy_implementation.rclpy_logging_configure(capsule)
_rclpy.RCLError: Failed to initialize logging: Failed to get logging directory, at /home/usr/ros2_foxy/src/ros2/rcl_logging/rcl_logging_spdlog/src/rcl_logging_spdlog.cpp:84
Now it must have something to do with the environment, since it works in a normal python script. But how can I get this to work in my context? I think it's the last step to be able to control the lifecycle and config of nodes using a web interface which would be quite handy.
Hi,
It looks like log files are buffered. Is there any way to configure ROS to write to file with every log statement? I am trying to use https://vector.dev/docs/reference/configuration/sources/file/ to push ROS logs to loki, but the buffering is confusing.
Thank you,
Rick
I am using ROS2 Humble on Ubuntu 22.04.
When I try to start rviz2, it crashes during launch with the following error:
rviz2
[INFO] [1702033731.572901130] [rviz2]: Stereo is NOT SUPPORTED
rviz2: symbol lookup error: /opt/ros/humble/lib/librcl_logging_spdlog.so: undefined symbol: _ZN6spdlog7details7log_msgC1ENS_10source_locEN3fmt2v817basic_string_viewIcEENS_5level10level_enumES6_
Any idea, where this is coming from?
I also tried to uninstall and reinstall ROS completely, but that did not help.
See e.g. http://build.ros2.org/view/Fci/job/Fci__nightly-cross-vendor-connext-cyclonedds_ubuntu_focal_amd64/5/console which fails to build an overlay workspace while rcl_logging
is part of the underlay.
Currently, all logs are saved to the directory ~/.ros/log
, which is hardcoded in the following places:
In ROS 1, we can change the directory logs are saved to by setting the ROS_HOME
and/or ROS_LOG_DIR
environment variables.
It would be nice to have a way to configure the directory in ROS 2.
I think an environment variable is a convenient way for users to configure the logging directory, although I propose using a single environment variable instead of combining two (like in ROS 1).
How does log4cxx::PatternLayout
got release?
I've had some problems compiling the crystal branch of ROS2 from source with log4cxx for Ubuntu 16.04. When compiling with RCL_LOGGING_IMPLEMENTATION set to rcl_logging_log4cxx, I get the following warning for many packages:
Package 'rcl_logging_log4cxx' exports the include directory
'/home/rsa/ws/ros2/underlay_desktop/install/rcl_logging_log4cxx/share/rcl_logging_log4cxx/cmake/../../../include'
which doesn't exist
The build finally fails on:
CMake Error in CMakeLists.txt:
Imported target "rviz_common::rviz_common" includes non-existent path
"/home/rsa/ws/ros2/underlay_desktop/install/rcl_logging_log4cxx/include"
in its INTERFACE_INCLUDE_DIRECTORIES.
I've fixed it by adding to CMakeLists of rcl_logging_log4cxx:
install(DIRECTORY include/${PROJECT_NAME}
DESTINATION include/${PROJECT_NAME}
)
After this, everything compiles and works. Is this the "correct" solution? If yes, I can create a pull request.
To start, after speaking with @clalancette, here's a bullet list of the current state of affairs:
There a few problems with this:
/rosout
based on what you output to the console, limiting the remote debugger's ability to see more details than what is printed to the screen (I haven't confirmed this, but it seems to be the case based on the code)Additionally, the default logging backend that uses spdlog does not have any way to configure it using a file or the command line. There is a command line option to disable it entirely (see: #88 (comment))
The current state makes it impossible to configure the system in a few ways, the most important of which is a use case that came up from one of our clients where they would like to:
There are other use cases which might be considered, but this one I think is going to be pretty common and is not possible in the current situation.
For these reasons, I propose we make these changes:
rcl_logging_spdlog
(since spdlog does not have its own config file format)--log-level my_node:=file:debug,console:info
instead of --log-level my_node:=debug
We use fmtlib (fmt::fmt
cmake target) in our software, by downloading and building it with the rest of our software (cmake FetchContent and friends...).
We encountered a build failure using the newest humble release, which i traced back to a rouge fmt::fmt target appearing in our build (preventing us from building the latest fmtlib version ourself), transitively through rclcpp, rcl, rcl_logging and spdlog.
I'm not sure which component should or should not propagate that dependency upwards, but i think !90 is the particular change causing our problem here. I also found !60, which seems to do the exact opposite and seems convincing as well 😄
Feel free to close this as not an issue with rcl_logging, but i wanted to open an issue here as this might be a regression for more users than just us...
Similar to #14, compilation fails in the linking phase when building with the Clang option -stdlib=libc++
.
Ubuntu Focal / Clang 11
Starting >>> rcl
--- stderr: rcl
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::flush_()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::sink_it_(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::basic_file_sink(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern_(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter_(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::log(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::flush()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::logger::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, spdlog::pattern_time_type)
ld.lld: error: ld.lld: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::flush_()
error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::flush_()
ld.lld: error: ld.lld: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::sink_it_(spdlog::details::log_msg const&)
error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::sink_it_(spdlog::details::log_msg const&)ld.lld
: ld.llderror: : /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::basic_file_sink(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)error:
/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::basic_file_sink(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)
ld.lldld.lld: : error: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lldld.lld: : error: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern_(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern_(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lldld.lld: : error: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: ld.llderror: : /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter_(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)error:
/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter_(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)ld.lld
: ld.llderror: : /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::log(spdlog::details::log_msg const&)error:
/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::log(spdlog::details::log_msg const&)ld.lld
: ld.lld: error: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::flush()
/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::flush()ld.lld
: ld.llderror: : /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::logger::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, spdlog::pattern_time_type)error:
/opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::logger::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, spdlog::pattern_time_type)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::flush_()
clangld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::sink_it_(spdlog::details::log_msg const&):
error: linker command failed with exit code 1 (use -v to see invocation)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::basic_file_sink(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern_(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter_(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::log(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::flush()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::logger::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, spdlog::pattern_time_type)
make[2]: *** [test/CMakeFiles/client_fixture__rmw_fastrtps_dynamic_cpp.dir/build.make:150: test/client_fixture__rmw_fastrtps_dynamic_cpp] Error 1
make[1]: *** [CMakeFiles/Makefile2:362: test/CMakeFiles/client_fixture__rmw_fastrtps_dynamic_cpp.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [test/CMakeFiles/test_security.dir/build.make:114: test/test_security] Error 1
make[1]: *** [CMakeFiles/Makefile2:306: test/CMakeFiles/test_security.dir/all] Error 2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [test/CMakeFiles/test_validate_topic_name.dir/build.make:111: test/test_validate_topic_name] Error 1
make[1]: *** [CMakeFiles/Makefile2:335: test/CMakeFiles/test_validate_topic_name.dir/all] Error 2
make[2]: *** [test/CMakeFiles/service_fixture__rmw_fastrtps_dynamic_cpp.dir/build.make:150: test/service_fixture__rmw_fastrtps_dynamic_cpp] Error 1
make[1]: *** [CMakeFiles/Makefile2:389: test/CMakeFiles/service_fixture__rmw_fastrtps_dynamic_cpp.dir/all] Error 2
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::flush_()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::sink_it_(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::basic_file_sink(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern_(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter_(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::log(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::flush()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::logger::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, spdlog::pattern_time_type)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [test/CMakeFiles/test_timer__rmw_fastrtps_dynamic_cpp.dir/build.make:114: test/test_timer__rmw_fastrtps_dynamic_cpp] Error 1
make[1]: *** [CMakeFiles/Makefile2:447: test/CMakeFiles/test_timer__rmw_fastrtps_dynamic_cpp.dir/all] Error 2
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::flush_()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::sink_it_(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::basic_file_sink<std::__1::mutex>::basic_file_sink(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_pattern_(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::set_formatter_(std::__1::unique_ptr<spdlog::formatter, std::__1::default_delete<spdlog::formatter> >)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::log(spdlog::details::log_msg const&)
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::sinks::base_sink<std::__1::mutex>::flush()
ld.lld: error: /opt/ros/master/install/lib/librcl_logging_spdlog.so: undefined reference to spdlog::logger::set_pattern(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, spdlog::pattern_time_type)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [test/CMakeFiles/test_namespace__rmw_fastrtps_dynamic_cpp.dir/build.make:152: test/test_namespace__rmw_fastrtps_dynamic_cpp] Error 1
make[1]: *** [CMakeFiles/Makefile2:418: test/CMakeFiles/test_namespace__rmw_fastrtps_dynamic_cpp.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
---
Failed <<< rcl [ Exited with code 2 ]
It's currently the case that all of the rcl_logging_*
backends (rcl_logging_spdlog
, rcl_logging_log4cxx
, and rcl_logging_spdlog
) duplicate the API from https://github.com/ros2/rcl/blob/d655147310e3e63aff1555ad40fca1bb9cb7783e/rcl/include/rcl/logging_external_interface.h . Further, they also duplicate some of the internal type names from rcl. The reason they currently do this is so we don't have a circular dependency; since rcl depends on a "default" logging implementation, the logging implementations cannot also depend on rcl. We should think about the right way to break this dependency cycle and change all of this to use that.
Using humble on 22.04, I'm having trouble building ros2_dotnet.
I'm getting the error below, which seems to be related to rcl_logging.
I have packages such as libspdlog1 libspdlog-dev installed.
Apologies if this has nothing to do with rcl_logging, or if this is an issue on my end. Any pointers would be appreciated.
Starting >>> rcldotnet
--- stderr: rcldotnet
CMake Error at /opt/ros/humble/share/rcl_logging_spdlog/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package):
By not providing "Findspdlog.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "spdlog", but
CMake did not find one.
Could not find a package configuration file provided by "spdlog" with any
of the following names:
spdlogConfig.cmake
spdlog-config.cmake
Add the installation prefix of "spdlog" to CMAKE_PREFIX_PATH or set
"spdlog_DIR" to a directory containing one of the above files. If "spdlog"
provides a separate development package or SDK, be sure it has been
installed.
Call Stack (most recent call first):
/opt/ros/humble/share/rcl_logging_spdlog/cmake/rcl_logging_spdlogConfig.cmake:41 (include)
/opt/ros/humble/share/rcl/cmake/ament_cmake_export_dependencies-extras.cmake:21 (find_package)
/opt/ros/humble/share/rcl/cmake/rclConfig.cmake:41 (include)
CMakeLists.txt:8 (find_package)
---
Failed <<< rcldotnet [0.26s, exited with code 1]
So when trying to get this to build for ros2/rcl#327, I realized that the log4cxx
dependency isn't readily satisfiable on all of the platforms that we expect to support, causing build failures (ros2/rcl#327 (comment)).
For Ubuntu Linux, this should be relatively easy to add, because it is available through apt
, but in order to get this out for ros2
, we'll need to get those dependencies available on MacOS and Windows as well (especially for making something as core as rcl or rcutils depend on it).
For Windows, the best approach would be to have a choco
package available (which there is currently not), or alternative provide a vendor package, as we have choosen to do for various other dependencies.
Currently the default logger rcl_logging_spdlog
always tries to write to the file system, and errors if it can't. This prevents it from being used on systems with read-only file systems. It should be configurable to allow outputting to the console only.
Related discussion #86 (comment)
Summary: New environment variable RCL_LOGGING_OUTPUT_SINK
that defaults to console,file
if unset.
I tried to compile a static ROS2 stack with the folling options:
colcon build --packages-ignore rclcpp_components --symlink-install --cmake-args -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DENABLE_SECURITY=OFF -DENABLE_SSL=NO -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DFORCE_BUILD_VENDOR_PKG=ON -DSPDLOG_BUILD_SHARED=OFF
Multipel packages can not be build because rcl_logging_spdlog is not exporting spdlog as a dependency.
I belive PR 60 has broken static builds.
Adding
ament_target_dependencies(${PROJECT_NAME} rcl_logging_interface rcpputils rcutils spdlog )
for static builds should solve the problems.
This issue tracks the progression of packages in rcl_logging
that have been deemed necessary for Quality Level 1 and a 1.0 version level. It follows the outline described in REP 2004.
The packages slated for Quality Level 1 for ROS 2 Foxy are:
Excluded for Quality Level 1 at this time:
semver
according to the recommendation for ROS Core packages in the ROS 2 Developer Guide.Documentation
ament_copyright
Testing:
Dependencies:
Platform Support
Security
If I understand correctly there's no reason to ament_export_dependencies(spdlog spdlog_vendor)
. This call makes downstream packages find_package()
them, but downstream code shouldn't need to know about them at all in order to use this logging implementation. The <exec_depend>spdlog*
is enough to make the spdlog libraries available at runtime.
@hidmic thoughts?
Followup from #9 (comment). This will make the packages conform to the ROS 2 style a bit more. There will probably be some code changes required to make the linter pass.
Same question from forum:
https://answers.ros.org/question/389402/how-to-limit-ros2-log-size/
If you attempt to build ROS2 with clang and libc++ you will run into build issues when linking the rcl package because it is unable to find the Log4cxx API's used by rcl_logging_log4cxx. This is likely due to the fact that the version of log4cxx that is used comes from an apt repository and is likely compiled using libstdc++. Since the log4cxx API's use std lib classes it is not able to resolve linking the classes from one std lib to the other.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.