| ... | ... |
@@ -1745,6 +1745,25 @@ function policy_add() {
|
| 1745 | 1745 |
} |
| 1746 | 1746 |
|
| 1747 | 1747 |
|
| 1748 |
+# This function sets log formatting options for colorizing log |
|
| 1749 |
+# output to stdout. It is meant to be called by lib modules. |
|
| 1750 |
+# The last two parameters are optional and can be used to specify |
|
| 1751 |
+# non-default value for project and user format variables. |
|
| 1752 |
+# Defaults are respectively 'project_name' and 'user_name' |
|
| 1753 |
+# |
|
| 1754 |
+# setup_colorized_logging something.conf SOMESECTION |
|
| 1755 |
+function setup_colorized_logging() {
|
|
| 1756 |
+ local conf_file=$1 |
|
| 1757 |
+ local conf_section=$2 |
|
| 1758 |
+ local project_var=${3:-"project_name"}
|
|
| 1759 |
+ local user_var=${4:-"user_name"}
|
|
| 1760 |
+ # Add color to logging output |
|
| 1761 |
+ iniset $conf_file $conf_section logging_context_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[01;36m%(request_id)s [00;36m%("$user_var")s %("$project_var")s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m"
|
|
| 1762 |
+ iniset $conf_file $conf_section logging_default_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 1763 |
+ iniset $conf_file $conf_section logging_debug_format_suffix "[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m" |
|
| 1764 |
+ iniset $conf_file $conf_section logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m" |
|
| 1765 |
+} |
|
| 1766 |
+ |
|
| 1748 | 1767 |
# Restore xtrace |
| 1749 | 1768 |
$XTRACE |
| 1750 | 1769 |
|
| ... | ... |
@@ -255,12 +255,9 @@ function configure_cinder() {
|
| 255 | 255 |
iniset $CINDER_CONF DEFAULT volume_clear none |
| 256 | 256 |
fi |
| 257 | 257 |
|
| 258 |
+ # Format logging |
|
| 258 | 259 |
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then |
| 259 |
- # Add color to logging output |
|
| 260 |
- iniset $CINDER_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[01;36m%(request_id)s [00;36m%(user_id)s %(project_id)s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 261 |
- iniset $CINDER_CONF DEFAULT logging_default_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 262 |
- iniset $CINDER_CONF DEFAULT logging_debug_format_suffix "[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m" |
|
| 263 |
- iniset $CINDER_CONF DEFAULT logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m" |
|
| 260 |
+ setup_colorized_logging $CINDER_CONF DEFAULT "project_id" "user_id" |
|
| 264 | 261 |
fi |
| 265 | 262 |
|
| 266 | 263 |
if [ "$CINDER_DRIVER" == "XenAPINFS" ]; then |
| ... | ... |
@@ -1,4 +1,4 @@ |
| 1 |
-# lib/heat |
|
| 1 |
+etup lib/heat |
|
| 2 | 2 |
# Install and start **Heat** service |
| 3 | 3 |
|
| 4 | 4 |
# To enable, add the following to localrc |
| ... | ... |
@@ -86,10 +86,7 @@ function configure_heat() {
|
| 86 | 86 |
iniset $HEAT_CONF DEFAULT use_syslog $SYSLOG |
| 87 | 87 |
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then |
| 88 | 88 |
# Add color to logging output |
| 89 |
- iniset $HEAT_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[01;36m%(request_id)s [00;36m%(user_name)s %(project_name)s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 90 |
- iniset $HEAT_CONF DEFAULT logging_default_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 91 |
- iniset $HEAT_CONF DEFAULT logging_debug_format_suffix "[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m" |
|
| 92 |
- iniset $HEAT_CONF DEFAULT logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m" |
|
| 89 |
+ setup_colorized_logging $HEAT_CONF DEFAULT |
|
| 93 | 90 |
fi |
| 94 | 91 |
|
| 95 | 92 |
# keystone authtoken |
| ... | ... |
@@ -534,6 +534,11 @@ function _configure_neutron_common() {
|
| 534 | 534 |
iniset $NEUTRON_CONF quotas quota_security_group_rule -1 |
| 535 | 535 |
fi |
| 536 | 536 |
|
| 537 |
+ # Format logging |
|
| 538 |
+ if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then |
|
| 539 |
+ setup_colorized_logging $NEUTRON_CONF DEFAULT |
|
| 540 |
+ fi |
|
| 541 |
+ |
|
| 537 | 542 |
_neutron_setup_rootwrap |
| 538 | 543 |
} |
| 539 | 544 |
|
| ... | ... |
@@ -499,12 +499,9 @@ function create_nova_conf() {
|
| 499 | 499 |
if [ "$API_RATE_LIMIT" != "True" ]; then |
| 500 | 500 |
iniset $NOVA_CONF DEFAULT api_rate_limit "False" |
| 501 | 501 |
fi |
| 502 |
+ # Format logging |
|
| 502 | 503 |
if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then |
| 503 |
- # Add color to logging output |
|
| 504 |
- iniset $NOVA_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[01;36m%(request_id)s [00;36m%(user_name)s %(project_name)s%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 505 |
- iniset $NOVA_CONF DEFAULT logging_default_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [[00;36m-%(color)s] [01;35m%(instance)s%(color)s%(message)s[00m" |
|
| 506 |
- iniset $NOVA_CONF DEFAULT logging_debug_format_suffix "[00;33mfrom (pid=%(process)d) %(funcName)s %(pathname)s:%(lineno)d[00m" |
|
| 507 |
- iniset $NOVA_CONF DEFAULT logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m" |
|
| 504 |
+ setup_colorized_logging $NOVA_CONF DEFAULT |
|
| 508 | 505 |
else |
| 509 | 506 |
# Show user_name and project_name instead of user_id and project_id |
| 510 | 507 |
iniset $NOVA_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_name)s] %(instance)s%(message)s" |