ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

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.

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.

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)

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);

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);