ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
I do this quite often when writing new nodes in C++. Usually what I do is place the following little snippet right after my call to ros::init
log4cxx::LoggerPtr my_logger =
log4cxx::Logger::getLogger(ROSCONSOLE_DEFAULT_NAME);
my_logger->setLevel(
ros::console::g_level_lookup[ros::console::levels::Debug]);
This will set the node's log level to Debug. Then I comment it out after the node is sufficiently developed. I have never really looked into doing this in rospy
or roslisp
, but would also be interested in figuring out how.
2 | No.2 Revision |
I do this quite often when writing new nodes in C++. Usually what I do is place the following little snippet right after my call to ros::init
log4cxx::LoggerPtr my_logger =
log4cxx::Logger::getLogger(ROSCONSOLE_DEFAULT_NAME);
my_logger->setLevel(
ros::console::g_level_lookup[ros::console::levels::Debug]);
This will set the node's log level to Debug. Then I comment it out after the node is sufficiently developed. I have never really looked into doing this in rospy
or roslisp
, but would also be interested in figuring out how.
3 | No.3 Revision |
I do this quite often when writing new nodes in C++. Usually what I do is place the following little snippet right after my call to ros::init
log4cxx::LoggerPtr my_logger =
log4cxx::Logger::getLogger(ROSCONSOLE_DEFAULT_NAME);
my_logger->setLevel(
ros::console::g_level_lookup[ros::console::levels::Debug]);
This will set the node's log level to Debug. Then I comment it out after the node is sufficiently developed. I have never really looked into doing this in rospy
or roslisp
, but would also be interested in figuring out how.
EDIT
I just realized that this is quite easy to do with rospy
as well. As documented here, you can simply pass the log_level
argument to a call to rospy.init_node()
e.g.
rospy.init_node('my_node', log_level=rospy.DEBUG)
4 | No.4 Revision |
I do this quite often when writing new nodes in C++. Usually what I do is place the following little snippet right after my call to ros::init
log4cxx::LoggerPtr my_logger =
log4cxx::Logger::getLogger(ROSCONSOLE_DEFAULT_NAME);
my_logger->setLevel(
ros::console::g_level_lookup[ros::console::levels::Debug]);
This will set the node's log level to Debug. Then I comment it out after the node is sufficiently developed. I have never really looked into doing this in rospy
or roslisp
, but would also be interested in figuring out how.
EDIT
I just realized that this is quite easy to do with rospy
as well. As documented here, you can simply pass the log_level
argument to a call to rospy.init_node()
e.g.
rospy.init_node('my_node', log_level=rospy.DEBUG)
EDIT 2
Just found my own answer 5 years later and read comment from @dirk thomas... I think he was suggesting that something like the following would be much better than my original answer:
ros::console::set_logger_level(ROSCONSOLE_DEFAULT_NAME, ros::console::levels::Debug);
5 | No.5 Revision |
I do this quite often when writing new nodes in C++. Usually what I do is place the following little snippet right after my call to ros::init
log4cxx::LoggerPtr my_logger =
log4cxx::Logger::getLogger(ROSCONSOLE_DEFAULT_NAME);
my_logger->setLevel(
ros::console::g_level_lookup[ros::console::levels::Debug]);
This will set the node's log level to Debug. Then I comment it out after the node is sufficiently developed. I have never really looked into doing this in rospy
or roslisp
, but would also be interested in figuring out how.
EDIT
I just realized that this is quite easy to do with rospy
as well. As documented here, you can simply pass the log_level
argument to a call to rospy.init_node()
e.g.
rospy.init_node('my_node', log_level=rospy.DEBUG)
EDIT 2
Just found my own answer 5 years later and read comment from @dirk thomas... I think he was suggesting that something like the following would be much better than my original answer:
ros::console::set_logger_level(ROSCONSOLE_DEFAULT_NAME, ros::console::levels::Debug);