From 1fd2247ce37cba579df4c58f1e824a3b20131bf7 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 31 Mar 2016 16:02:16 +0200 Subject: [PATCH] MT#18811 Send debug output to stderr If we send debug output to stdout then its output might get used in variable assignments, causing debug runs to have different results than the non-debug ones, like: | root@sp2:/etc/ngcp-config# DEBUG=1 ngcpcfg build --no-action-failure /etc/mysql/ | 2016-03-30 18:58:00: DEBUG: sourced configuration file /etc/ngcp-config/ngcpcfg.cfg | 2016-03-30 18:58:00: DEBUG: sourced configuration file /etc/ngcp-config/ngcpcfg.d/shared_storage.cfg | 2016-03-30 18:58:00: DEBUG: /usr/share/ngcp-ngcpcfg/scripts//build --no-action-failure /etc/mysql/ | 2016-03-30 18:58:00: DEBUG: sourced configuration file /etc/ngcp-config/ngcpcfg.cfg | 2016-03-30 18:58:00: DEBUG: sourced configuration file /etc/ngcp-config/ngcpcfg.d/shared_storage.cfg | 2016-03-30 18:58:00: DEBUG: sourced configuration file /etc/ngcp-config/ngcpcfg.cfg | 2016-03-30 18:58:00: DEBUG: sourced configuration file /etc/ngcp-config/ngcpcfg.d/shared_storage.cfg | 2016-03-30 18:58:00: Error: branch '2016-03-30 18:58:00: DEBUG: get_active_branch master | 2016-03-30 18:58:00: DEBUG: cd /etc/ngcp-config | 2016-03-30 18:58:00: DEBUG: current_branch = master | master' in '/etc/ngcp-config' active - please switch to branch 'master' before continuing. Change-Id: I58a8882054b9accdff14d79e9a963109f2bbb91f --- docs/ngcpcfg.txt | 2 ++ functions/main | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/ngcpcfg.txt b/docs/ngcpcfg.txt index 263c5e8f..c7e0fb80 100644 --- a/docs/ngcpcfg.txt +++ b/docs/ngcpcfg.txt @@ -176,6 +176,8 @@ Options **--debug** []:: Run actions (see next section) in verbose mode, useful for debugging. +Debug output will be sent to syslog (available as /var/log/ngcp/ngcpcfg.log on +NGCP systems) as well as stderr. **--help**:: diff --git a/functions/main b/functions/main index bc4e9128..d629ee4c 100644 --- a/functions/main +++ b/functions/main @@ -44,7 +44,7 @@ log_error() { log_debug() { if [ -n "${DEBUG:-}" ] ; then logger -t ngcpcfg -- "Debug: $*" - console_output "DEBUG: $*\n" + console_output "DEBUG: $*\n" >&2 fi }