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
747 stars 914 forks source link

Remove "is_child_mode()" n from roslaunch/nodeprocess.py #2310

Open paszoujp opened 1 year ago

paszoujp commented 1 year ago

related ros forum topic: https://answers.ros.org/question/251206/ros-log-named-and-stderr/

The is_child_mode() is only used for disabling creating a stderr logfile on local machine. I assume the mechanism is designed that local error messages are streamed to a console, and only remotely launched nodes needs a error log file to look into later. But this is stupid because the important error messages may be easily lost in local terminals due to machine shutdown or flushed away in tons of screen output lines. There's no parameter setting to enable creating a local stderr log unless you hack the code. I strongly recommend removing this feature thus it is not used elsewhere, not saving much disk space and a drawback for debugging.

# line 266 in nodeprocess.py
        if self.log_output:
            outf, errf = [os.path.join(log_dir, '%s-%s.log'%(logfname, n)) for n in ['stdout', 'stderr']]
            if self.respawn:
                mode = 'a'
            else:
                mode = 'w'
            logfileout = open(outf, mode)
            if is_child_mode():  # this prevented creating a stderr file
                logfileerr = open(errf, mode)