LOG Generation and how to deactivate it - AD-EYE/AD-EYE_Core GitHub Wiki
Run without any logs generation
The research (part 1-2)
The objective of this research was to be able to fully deactivate the logs generated within the /home/.ros/log folder. Deactivating these logs could improve the performance of running a simulation on the PX2.
Part 1: Issue Identification
Small recap of the problematic log files identified:
-
Most of the time:
- ndt_matching.log (autoware)
- master.log
- roslaunch-tegra-a.log
-
Sometimes:
- rosout.log
- navsat_driver.log
Part 2: Research on Deleting Log Generation
Now that the problematic files have been identified, we will attempt to deactivate log generation. The main goal is to find a straightforward solution that allows us to easily deactivate and reactivate log generation for all log files as needed for testing.
Different solutions tested:
S1. Change the output of each node: to “screen” instead of “log” ('output="screen"')
Would be needed in every node launch file of the project.
S2. Use “--screen” option of “roslaunch”: to automatically force to screen every node ('roslaunch --screen adeye manager_performance.launch')
Remove a couple of lines of different files , does not impact logs significantly.
S3. Not launching “rosout”: with “roscore” to avoid certain logs, replacing 'roscore' with 'rosmaster --core'
Also Remove a couple of lines of different files , does not impact logs significantly.
S4. Define the log level: in each Python and C++ file (level = logging.CRITICAL)
Too many files to modify; it would be needed in every file of the project.
S5. manager.launch: Create a config file in the adeye package (create config/empty.conf and put log4j.rootLogger=OFF). Official ROS wiki solution.
Does not work.
S6. Logging directory: redirect the output of logging to “null” to /dev/null (Change ROS_LOG_DIR at the end of ~/.bashrc)
Does not work because the nodes won't start if not allowed to write in the /dev/null folder.
The Solution
Part 3: Solution Found and How to Use It
The solution found uses a similar approach to the last solution tested (number 6), but we will redirect the logs to a special folder designed for this specific purpose. This time, the nodes will start considering that they can write in the folder, but they won't be able to print any logs afterward.
This solution uses xrgtn/nullfs as follows:
(1). Install xrgtn/nullfs
sudo apt update
sudo apt install -y git libfuse-dev build-essential
git clone https://github.com/xrgtn/nullfs
cd nullfs/
make nullfs
(2). Make nullfs directory
mkdir ~/nulldir
./nullfs ~/nulldir/
(3). Change ROS_LOG_DIR. Add the following lines at the end of ~/.bashrc
export ROS_LOG_DIR=~/nulldir
~/nullfs/nullfs ~/nulldir
(4). Test
source ~/.bashrc
Run any ROS/ROS2 program and check that no files are in ~/.ros/log and ~/nulldir.
Final bashrc file example for easy deactivation and reactivation:
# To Disbale ROS logging uncomment theses two lines and source the bashrc and comment the one after
#export ROS_LOG_DIR=~/nulldir
#~/nullfs/nullfs ~/nulldir
# To get ROS to log back again uncomment this line and source the bashrc and comment the previous ones
export ROS_LOG_DIR=/home/adeye/.ros/log/