ros / ros_comm

ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).
http://wiki.ros.org/ros_comm
762 stars 912 forks source link

roslaunch: option to disable all logging to file system #139

Open tfoote opened 11 years ago

tfoote commented 11 years ago

I have an embedded computer on the robot which runs off of an SD card. It is highly desirable to be able to disable output to the file system, notably logging, but ROS does not support this.

Please see discussion at http://answers.ros.org/question/594/how-can-i-completely-disable-writing-logs-to

It seems that rosconsole, rospy, roscpp, and rosout all need to be modified, but I don't really understand.

trac data:

tfoote commented 11 years ago

[kwc] It appears there are some issues fully disabling logging, but you can greatly reduce with:

rosconsole.config: replace INFO/WARN with FATAL

python_logging.config: replace DEBUG with CRITICAL

If you want to disable roslaunch logging, use the attached patch.

tfoote commented 11 years ago

[veltrop] Excellent, the roslaunch logging patch is very helpful.

tfoote commented 11 years ago

[veltrop] Followed your steps, plus recompiled everything with this in my $ROS_ROOT/rosconfig.cmake: set(ROS_BUILD_TYPE MinSizeRel) set(ROS_COMPILE_FLAGS "-DROSCONSOLE_MIN_SEVERITY=5 ${ROS_COMPILE_FLAGS}")

I still get logging that begins with [roscpp_internal] and [DEBUG]

tfoote commented 11 years ago

[kwc] Right, that's one the issues I'm referring to. It appears that the roscpp_internal logger may not work with the config file, but I need to investigate more before filing a separate ticket.

tfoote commented 11 years ago

[kwc] transferring ticket to troy to look at. The basic issue is: "how do I disable logging of the roscpp_internal logger". After some basic experiments with the logging config file, I'm not sure this logger is respecting the external configuration.

tfoote commented 11 years ago

[straszheim] compile with ROSCPP_LOG_DISABLE defined to disable the roscpp_internal logger completely. In r13673. Leaving ticket open pending confirmation that this does the trick...

tfoote commented 11 years ago

[straszheim] ROSCPP_LOG_DISABLE is gone. In r13691 ROSCPP_LOG_DEBUG has been converted:

define ROSCPP_LOG_DEBUG(...) \ ROS_DEBUG_NAMED("roscpp_internal", VA_ARGS)

Note that rosout depends on some file_log path calculating stuff, looks like some more detangling could be in order.

leaving ticket open. Veltrop, does this work for you?

protobits commented 9 years ago

Any update to this? I have the same requirement (for the same reason). I do like output to console so disabling logging levels is not an acceptable solution for me. I only want to disable logging to filesystem. Is it possible without recompiling anything?

wjwwood commented 9 years ago

As far as I can see from this issue, the linked ros answers question, and my experience, I'd say no there is no way to do this still. It will likely require a pull request to get the ball moving on this type of feature.

dirk-thomas commented 9 years ago

The ticket is marked with the milestone untargeted which states:

It is unlikely that the maintainers will have time to address these issues. Please provide pull requests if you want these issues to be addressed.
protobits commented 9 years ago

Ok, thanks for clearing up the state of this issue.

I was wondering if this could be achieve by simple using a particular log4cxx configuration in the corresponding file. I don't have much experience with log4cxx to understand if it is possible or not (or if it would require particular implementation to handle it).

On Tue, Oct 13, 2015 at 2:39 PM, Dirk Thomas notifications@github.com wrote:

The ticket is also marked with the milestone untargeted which states:

It is unlikely that the maintainers will have time to address these issues. Please provide pull requests if you want these issues to be addressed.

— Reply to this email directly or view it on GitHub https://github.com/ros/ros_comm/issues/139#issuecomment-147787963.

dirk-thomas commented 8 years ago

You can call the following function to completely shutdown the ROS logging system (independently on which backend is being used for logging):

ros::console::shutdown();

For existing binaries you can provide a custom rosconsole configuration file:

See the API documentation of log4cxx for more information.

dirk-thomas commented 8 years ago

Added the same information to the rosconsole wiki page.

protobits commented 8 years ago

Since the requirement was to disable only filesystem logging and not all the logging (i.e. leave output to console working), shouldn't this be left open?

dirk-thomas commented 8 years ago

This thread is mostly about rosconsole and it does not explicitly log to the file system.

Can you please describe your use case again?

protobits commented 8 years ago

Ok, I understand my use case was the same as the original poster due to the title (disable logging to filesystem). In my case I thought it would be useful to have output to console while disabling output to filesystem, since the cost of logging to filesystem may be high (in my case, an Odroid computer with an SD card).

On Thu, Dec 10, 2015 at 4:32 PM, Dirk Thomas notifications@github.com wrote:

This thread is mostly about rosconsole and it does not explicitly log to the file system.

Can you please describe your use case again?

— Reply to this email directly or view it on GitHub https://github.com/ros/ros_comm/issues/139#issuecomment-163726973.

dirk-thomas commented 8 years ago

How are you starting the software which write to the filesystem? Is it about the logging of roslaunch ?

protobits commented 8 years ago

I use roslaunch to launch a node which uses ROS_INFO_STREAM. I can see several log files created in .ros/log. The worst is rosout.log which grows rapidly. I can see it contains all msgs printed to console. I tried setting output="screen" for this node in the roslaunch file and also using --screen for roslaunch and I still see rosout.log being updated. Only way to disable this is to reduce the logging level but this also disables output to screen.

On Thu, Dec 10, 2015 at 4:36 PM, Dirk Thomas notifications@github.com wrote:

How are you starting the software which write to the filesystem? Is it about the logging of roslaunch ?

— Reply to this email directly or view it on GitHub https://github.com/ros/ros_comm/issues/139#issuecomment-163728066.

dirk-thomas commented 8 years ago

I have update the title to clarify the scope of the requested feature.

When the launch file specifies output="screen" for a node it does not log the output of the node to a file. I confirmed that by running roslaunch roscpp_tutorials talker_listener.launch. A log file is still being generated but it only contains information about the environment and spawned processes (cat ~/.ros/log/latest/roslaunch-drudge-<PID>.log). No logfiles fot the nodes are being created (e.g. ~/.ros/log/latest/talker*.log).

The same works for me when passing --screen to roslaunch (both with Indigo).

The logfile containing the process information is pretty short and should grow over time (even nodes are not continuously restarted). It is currently not possible to disable that. But it sounds like that is not your problem.

Which version of ROS are you using? Maybe you want to try the tutorial example I used or share a minimal reproducible example which has the problem for you?

protobits commented 8 years ago

I'm using indigo. It also seems strange to me this does not work. I will try and report back.

pmirabel commented 3 years ago

Hi, could someone please give me an update on this topic please?

mmmherma commented 2 years ago

Hello everybody!

I have been also stucked for a day within this topic :sweat_smile: but now is crystal clear for me. I am using ROS Noetic.

  1. export ROSCONSOLE_CONFIG_FILE=/path/to/your/custom/config/file works like a charm.
  2. The content of your /path/to/your/custom/config/file must be log4j.threshold=OFF in order to disable the ROS logging facility.
  3. Now the tricky part for me. It is of paramount importance remember that disabling ROS log does not disable standard output. That means every single std::cout you have in your code will be placed into your (typically) $HOME/.ros/log inside the given node folder. When roslaunch --screen is enabled, standard output will prompt the terminal, so no std::cout logs will be stored in disk (or SD card). But when --screen is not enabled, std::cout will be stored into disk.

For me, the key point is realize that disabling ROS logging facility does not stop standard output as std::cout :muscle:

Hope this post will help somebody :crossed_fingers:

Thank you!