Skip to content

Commit 0c48554

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Make the log output pretty and more useful"
2 parents 877bbb2 + 6f13ba3 commit 0c48554

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

stack.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ SYSLOG=`trueorfalse False $SYSLOG`
262262
SYSLOG_HOST=${SYSLOG_HOST:-$HOST_IP}
263263
SYSLOG_PORT=${SYSLOG_PORT:-516}
264264

265+
# Use color for logging output
266+
LOG_COLOR=`trueorfalse True $LOG_COLOR`
267+
265268
# Service startup timeout
266269
SERVICE_TIMEOUT=${SERVICE_TIMEOUT:-60}
267270

@@ -1762,6 +1765,16 @@ fi
17621765
if [ "$API_RATE_LIMIT" != "True" ]; then
17631766
add_nova_opt "api_rate_limit=False"
17641767
fi
1768+
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
1769+
# Add color to logging output
1770+
add_nova_opt "logging_context_format_string=%(asctime)s %(color)s%(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s%(color)s] %(instance)s%(color)s%(message)s"
1771+
add_nova_opt "logging_default_format_string=%(asctime)s %(color)s%(levelname)s %(name)s [-%(color)s] %(instance)s%(color)s%(message)s"
1772+
add_nova_opt "logging_debug_format_suffix=from (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d"
1773+
add_nova_opt "logging_exception_prefix=%(color)s%(asctime)s TRACE %(name)s %(instance)s"
1774+
else
1775+
# Show user_name and project_name instead of user_id and project_id
1776+
add_nova_opt "logging_context_format_string=%(asctime)s %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s"
1777+
fi
17651778
17661779
17671780
# Provide some transition from EXTRA_FLAGS to EXTRA_OPTS

0 commit comments

Comments
 (0)