From bb77dc93deb744deef870c30a5c080d68a8e4a82 Mon Sep 17 00:00:00 2001 From: Markus Grimm Date: Mon, 1 Jan 2018 21:25:33 +0100 Subject: [PATCH 1/2] Fixed search strategy for python_logging config --- tools/rosgraph/src/rosgraph/roslogging.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tools/rosgraph/src/rosgraph/roslogging.py b/tools/rosgraph/src/rosgraph/roslogging.py index ac33576cd9..6ee83109ca 100644 --- a/tools/rosgraph/src/rosgraph/roslogging.py +++ b/tools/rosgraph/src/rosgraph/roslogging.py @@ -149,17 +149,18 @@ def configure_logging(logname, level=logging.INFO, filename=None, env=None): except OSError as e: sys.stderr.write("INFO: cannot create a symlink to latest log directory: %s\n" % e) - if 'ROS_PYTHON_LOG_CONFIG_FILE' in os.environ: - config_file = os.environ['ROS_PYTHON_LOG_CONFIG_FILE'] - else: - # search for logging config file in /etc/. If it's not there, - # look for it package-relative. - config_file = None + config_file = os.environ.get('ROS_PYTHON_LOG_CONFIG_FILE') + if not config_file: + # search for logging config file in ROS_HOME, ROS_ETC_DIR or relative + # to the rosgraph package directory. rosgraph_d = rospkg.RosPack().get_path('rosgraph') - for fname in ['python_logging.conf', 'python_logging.yaml']: - for f in [os.path.join(rospkg.get_ros_home(), 'config', fname), - '/etc/ros/%s'%(fname), - os.path.join(rosgraph_d, 'conf', fname)]: + for config_dir in [os.path.join(rospkg.get_ros_home(), 'config'), + rospkg.get_etc_ros_dir(), + os.path.join(rosgraph_d, 'conf')]: + for extension in ('conf', 'yaml', 'yml'): + f = os.path.join(config_dir, + 'python_logging{}{}'.format(os.path.extsep, + extension)) if os.path.isfile(f): config_file = f break From 9801667bc53bc9bf835c508987acf5ca80584dde Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Thu, 1 Feb 2018 13:16:45 -0800 Subject: [PATCH 2/2] remove support for a `yml` extension --- tools/rosgraph/src/rosgraph/roslogging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/rosgraph/src/rosgraph/roslogging.py b/tools/rosgraph/src/rosgraph/roslogging.py index 6ee83109ca..4986e81cbe 100644 --- a/tools/rosgraph/src/rosgraph/roslogging.py +++ b/tools/rosgraph/src/rosgraph/roslogging.py @@ -157,7 +157,7 @@ def configure_logging(logname, level=logging.INFO, filename=None, env=None): for config_dir in [os.path.join(rospkg.get_ros_home(), 'config'), rospkg.get_etc_ros_dir(), os.path.join(rosgraph_d, 'conf')]: - for extension in ('conf', 'yaml', 'yml'): + for extension in ('conf', 'yaml'): f = os.path.join(config_dir, 'python_logging{}{}'.format(os.path.extsep, extension))