ros_comm
ros_comm copied to clipboard
roslaunch: option to disable all logging to file system
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:
- Owner: straszheim
- Reporter: veltrop
- Reported at: Sun Apr 3 22:57:55 2011
- URL: https://code.ros.org/trac/ros/ticket/3438
[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.
[veltrop] Excellent, the roslaunch logging patch is very helpful.
[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]
[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.
[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.
[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...
[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?
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?
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.
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.
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 [email protected] 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.
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:
-
set the env variable
ROSCONSOLE_CONFIG_FILEto point to your custom file -
create a rosconsole configuration file containing the following:
log4j.threshold=OFF
See the API documentation of log4cxx for more information.
Added the same information to the rosconsole wiki page.
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?
This thread is mostly about rosconsole and it does not explicitly log to the file system.
Can you please describe your use case again?
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 [email protected] 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.
How are you starting the software which write to the filesystem? Is it about the logging of roslaunch ?
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 [email protected] 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.
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?
I'm using indigo. It also seems strange to me this does not work. I will try and report back.
Hi, could someone please give me an update on this topic please?
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.
export ROSCONSOLE_CONFIG_FILE=/path/to/your/custom/config/fileworks like a charm.- The content of your
/path/to/your/custom/config/filemust belog4j.threshold=OFFin order to disable the ROS logging facility. - 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::coutyou have in your code will be placed into your (typically)$HOME/.ros/loginside the given node folder. Whenroslaunch --screenis enabled, standard output will prompt the terminal, so nostd::coutlogs will be stored in disk (or SD card). But when--screenis not enabled,std::coutwill 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!