From 8190b8d305c6d323cc518f49634fa1babe8d5172 Mon Sep 17 00:00:00 2001 From: Tanishq Chaudhary Date: Sat, 19 Apr 2025 20:06:56 +0530 Subject: [PATCH 1/5] added a argument for accepting the log file name Signed-off-by: Tanishq Chaudhary --- ros2launch/ros2launch/command/launch.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ros2launch/ros2launch/command/launch.py b/ros2launch/ros2launch/command/launch.py index 1767d6e3..816a5e31 100644 --- a/ros2launch/ros2launch/command/launch.py +++ b/ros2launch/ros2launch/command/launch.py @@ -79,6 +79,8 @@ def add_arguments(self, parser, cli_name): parser.add_argument( '-d', '--debug', default=False, action='store_true', help='Put the launch system in debug mode, provides more verbose output.') + parser.add_argument('-f', '--log-file-name', default=None, + help='Name of the logging file') command_group = parser.add_mutually_exclusive_group() command_group.add_argument( '-p', '--print', '--print-description', default=False, action='store_true', From e0337fca597a0679580603675f18a060d8de5fd1 Mon Sep 17 00:00:00 2001 From: Tanishq Chaudhary Date: Sun, 20 Apr 2025 06:18:37 +0530 Subject: [PATCH 2/5] pass log file name as an argument to the launch service Signed-off-by: Tanishq Chaudhary --- ros2launch/ros2launch/api/api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ros2launch/ros2launch/api/api.py b/ros2launch/ros2launch/api/api.py index 3bdb5bd1..e7376603 100644 --- a/ros2launch/ros2launch/api/api.py +++ b/ros2launch/ros2launch/api/api.py @@ -159,10 +159,12 @@ def launch_a_launch_file( if args and args.launch_prefix_filter: launch_file_arguments.append(f'launch-prefix-filter:={args.launch_prefix_filter}') + log_file_name = args.log_file_name if args and args.log_file_name else None launch_service = launch.LaunchService( argv=launch_file_arguments, noninteractive=noninteractive, - debug=debug) + debug=debug, + log_file_name=log_file_name) parsed_launch_arguments = parse_launch_arguments(launch_file_arguments) # Include the user provided launch file using IncludeLaunchDescription so that the From 9a9faf6b371f6ddb591d201db157185438946078 Mon Sep 17 00:00:00 2001 From: Tanishq Chaudhary Date: Fri, 25 Apr 2025 19:55:03 +0530 Subject: [PATCH 3/5] resolve linter error Signed-off-by: Tanishq Chaudhary --- ros2launch/ros2launch/command/launch.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ros2launch/ros2launch/command/launch.py b/ros2launch/ros2launch/command/launch.py index 816a5e31..e41c2fc3 100644 --- a/ros2launch/ros2launch/command/launch.py +++ b/ros2launch/ros2launch/command/launch.py @@ -79,7 +79,8 @@ def add_arguments(self, parser, cli_name): parser.add_argument( '-d', '--debug', default=False, action='store_true', help='Put the launch system in debug mode, provides more verbose output.') - parser.add_argument('-f', '--log-file-name', default=None, + parser.add_argument( + '-f', '--log-file-name', default=None, help='Name of the logging file') command_group = parser.add_mutually_exclusive_group() command_group.add_argument( From b9181a3c9c3a912edf4b44b67bc631c6cd7af332 Mon Sep 17 00:00:00 2001 From: Tanishq Chaudhary Date: Sat, 26 Apr 2025 00:40:12 +0530 Subject: [PATCH 4/5] updated variable namign for better understanding and set default value for log file name Signed-off-by: Tanishq Chaudhary --- ros2launch/ros2launch/api/api.py | 2 +- ros2launch/ros2launch/command/launch.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ros2launch/ros2launch/api/api.py b/ros2launch/ros2launch/api/api.py index e7376603..356d81dd 100644 --- a/ros2launch/ros2launch/api/api.py +++ b/ros2launch/ros2launch/api/api.py @@ -159,7 +159,7 @@ def launch_a_launch_file( if args and args.launch_prefix_filter: launch_file_arguments.append(f'launch-prefix-filter:={args.launch_prefix_filter}') - log_file_name = args.log_file_name if args and args.log_file_name else None + log_file_name = args.log_file_name if args and args.log_file_name else 'launch' launch_service = launch.LaunchService( argv=launch_file_arguments, noninteractive=noninteractive, diff --git a/ros2launch/ros2launch/command/launch.py b/ros2launch/ros2launch/command/launch.py index e41c2fc3..caaff917 100644 --- a/ros2launch/ros2launch/command/launch.py +++ b/ros2launch/ros2launch/command/launch.py @@ -79,9 +79,6 @@ def add_arguments(self, parser, cli_name): parser.add_argument( '-d', '--debug', default=False, action='store_true', help='Put the launch system in debug mode, provides more verbose output.') - parser.add_argument( - '-f', '--log-file-name', default=None, - help='Name of the logging file') command_group = parser.add_mutually_exclusive_group() command_group.add_argument( '-p', '--print', '--print-description', default=False, action='store_true', @@ -94,6 +91,9 @@ def add_arguments(self, parser, cli_name): help=("Show all launched subprocesses' output by overriding their output" ' configuration using the OVERRIDE_LAUNCH_PROCESS_OUTPUT envvar.') ) + parser.add_argument( + '-f', '--log-file-name', type=str, default='launch', + help='Name of the log file (postfixed with .log automatically if not provided).') parser.add_argument( '--launch-prefix', help='Prefix command, which should go before all executables. ' From 9e061c9e4153e3d23261152a1f04d43e8c5388bf Mon Sep 17 00:00:00 2001 From: Tanishq Chaudhary Date: Wed, 30 Apr 2025 21:11:29 +0530 Subject: [PATCH 5/5] improve readability for accessing the log_file_name Co-authored-by: Katherine Scott Signed-off-by: Tanishq Chaudhary --- ros2launch/ros2launch/api/api.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ros2launch/ros2launch/api/api.py b/ros2launch/ros2launch/api/api.py index 356d81dd..3bcf7530 100644 --- a/ros2launch/ros2launch/api/api.py +++ b/ros2launch/ros2launch/api/api.py @@ -159,7 +159,9 @@ def launch_a_launch_file( if args and args.launch_prefix_filter: launch_file_arguments.append(f'launch-prefix-filter:={args.launch_prefix_filter}') - log_file_name = args.log_file_name if args and args.log_file_name else 'launch' + log_file_name = 'launch' + if args and args.log_file_name: + log_file_name = args.log_file_name launch_service = launch.LaunchService( argv=launch_file_arguments, noninteractive=noninteractive,