-
Notifications
You must be signed in to change notification settings - Fork 227
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
Cannot log in ROS2 node after building with cython #1199
Comments
We don't explicitly support or test |
Ok, so can you tell me why we cannot change logger severity between calls? It would help me understand the specific requirements behind this code and maybe then I would be able to find a solution |
I'm honestly not sure. That line comes from rclpy/rclpy/rclpy/impl/rcutils_logger.py Line 313 in 9536f8e
|
Hi @placek-robotec, I have check the rclpy library like @clalancette said,
if your severity changing on the same module it will throw the error. if you try to create a functions inside your python code for each log and call that wherever that particular logs needed, the problem will be fixed,
|
In normal python file, every line number will be considered and maked as new context, but in cython build or live python interpreter, you may encounter the error of severity level changed. |
I found the problem is in the .so file after built by cython doesn't give the proper line number to create a caller id, so if @clalancette by any changes to make line number things disable or something we can log with cython |
I don't think I can suggest a solution without deeper knowledge, but the problem seems to be in the rclpy/rclpy/rclpy/impl/rcutils_logger.py Line 301 in 9536f8e
as the contexts are cached by the callerId, and many non-CPython environments (cython included) would always return the same calledID (probably None-based) (see https://docs.python.org/3/library/inspect.html#inspect.currentframe). So I think this concept of caching context would cause problems not only for Cython, but I don't know how to solve this bug without removing the caching, which probably has been introduced for some reason (that I don't know). |
Bug report
Required Info:
Steps to reproduce issue
Write simple node with at least two logging statements with different severity
Update your
setup.py
to compile python with following command:Expected behavior
Node prints logs in console.
Actual behavior
Exception with message "Logger severity cannot be changed between calls." is thrown.
Additional information
This is caused by implementation of
CallerId
:in file
rcutils_logger.py
. I understand perfectly that after "cythonization" of file my inspect module won't work anymore (because every call to inspect functions returns same line/file)The text was updated successfully, but these errors were encountered: