| ... | ... |
@@ -569,6 +569,19 @@ function vercmp {
|
| 569 | 569 |
esac |
| 570 | 570 |
} |
| 571 | 571 |
|
| 572 |
+# This sets up defaults we like in devstack for logging for tracking |
|
| 573 |
+# down issues, and makes sure everything is done the same between |
|
| 574 |
+# projects. |
|
| 575 |
+function setup_logging {
|
|
| 576 |
+ local conf_file=$1 |
|
| 577 |
+ local other_cond=${2:-"False"}
|
|
| 578 |
+ if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ] && [ "$other_cond" == "False" ]; then |
|
| 579 |
+ setup_colorized_logging $conf_file |
|
| 580 |
+ else |
|
| 581 |
+ setup_standard_logging_identity $conf_file |
|
| 582 |
+ fi |
|
| 583 |
+} |
|
| 584 |
+ |
|
| 572 | 585 |
# This function sets log formatting options for colorizing log |
| 573 | 586 |
# output to stdout. It is meant to be called by lib modules. |
| 574 | 587 |
# The last two parameters are optional and can be used to specify |
| ... | ... |
@@ -588,6 +601,11 @@ function setup_colorized_logging {
|
| 588 | 588 |
iniset $conf_file $conf_section logging_exception_prefix "%(color)s%(asctime)s.%(msecs)03d TRACE %(name)s [01;35m%(instance)s[00m" |
| 589 | 589 |
} |
| 590 | 590 |
|
| 591 |
+function setup_standard_logging_identity {
|
|
| 592 |
+ local conf_file=$1 |
|
| 593 |
+ iniset $conf_file DEFAULT logging_user_identity_format "%(project_name)s %(user_name)s" |
|
| 594 |
+} |
|
| 595 |
+ |
|
| 591 | 596 |
# These functions are provided for basic fall-back functionality for |
| 592 | 597 |
# projects that include parts of DevStack (Grenade). stack.sh will |
| 593 | 598 |
# override these with more specific versions for DevStack (with fancy |
| ... | ... |
@@ -333,12 +333,7 @@ function configure_cinder {
|
| 333 | 333 |
iniset $CINDER_CONF DEFAULT volume_clear $CINDER_VOLUME_CLEAR |
| 334 | 334 |
|
| 335 | 335 |
# Format logging |
| 336 |
- if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ] && [ "$CINDER_USE_MOD_WSGI" == "False" ]; then |
|
| 337 |
- setup_colorized_logging $CINDER_CONF |
|
| 338 |
- else |
|
| 339 |
- # Set req-id, project-name and resource in log format |
|
| 340 |
- iniset $CINDER_CONF DEFAULT logging_context_format_string "%(asctime)s.%(msecs)03d %(levelname)s %(name)s [%(request_id)s %(project_name)s] %(resource)s%(message)s" |
|
| 341 |
- fi |
|
| 336 |
+ setup_logging $CINDER_CONF $CINDER_USE_MOD_WSGI |
|
| 342 | 337 |
|
| 343 | 338 |
if [ "$CINDER_USE_MOD_WSGI" == "True" ]; then |
| 344 | 339 |
_cinder_config_apache_wsgi |
| ... | ... |
@@ -229,10 +229,8 @@ function configure_glance {
|
| 229 | 229 |
fi |
| 230 | 230 |
|
| 231 | 231 |
# Format logging |
| 232 |
- if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then |
|
| 233 |
- setup_colorized_logging $GLANCE_API_CONF |
|
| 234 |
- setup_colorized_logging $GLANCE_REGISTRY_CONF |
|
| 235 |
- fi |
|
| 232 |
+ setup_logging $GLANCE_API_CONF |
|
| 233 |
+ setup_logging $GLANCE_REGISTRY_CONF |
|
| 236 | 234 |
|
| 237 | 235 |
cp -p $GLANCE_DIR/etc/glance-registry-paste.ini $GLANCE_REGISTRY_PASTE_INI |
| 238 | 236 |
|
| ... | ... |
@@ -273,7 +271,7 @@ function configure_glance {
|
| 273 | 273 |
if is_service_enabled g-glare; then |
| 274 | 274 |
local dburl |
| 275 | 275 |
dburl=`database_connection_url glance` |
| 276 |
- setup_colorized_logging $GLANCE_GLARE_CONF |
|
| 276 |
+ setup_logging $GLANCE_GLARE_CONF |
|
| 277 | 277 |
iniset $GLANCE_GLARE_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL |
| 278 | 278 |
iniset $GLANCE_GLARE_CONF DEFAULT bind_host $GLANCE_SERVICE_LISTEN_ADDRESS |
| 279 | 279 |
iniset $GLANCE_GLARE_CONF DEFAULT bind_port $GLANCE_GLARE_PORT |
| ... | ... |
@@ -732,12 +732,7 @@ function _configure_neutron_common {
|
| 732 | 732 |
fi |
| 733 | 733 |
|
| 734 | 734 |
# Format logging |
| 735 |
- if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then |
|
| 736 |
- setup_colorized_logging $NEUTRON_CONF |
|
| 737 |
- else |
|
| 738 |
- # Show user_name and project_name by default like in nova |
|
| 739 |
- iniset $NEUTRON_CONF DEFAULT logging_user_identity_format "%(user_name)s %(project_name)s" |
|
| 740 |
- fi |
|
| 735 |
+ setup_logging $NEUTRON_CONF |
|
| 741 | 736 |
|
| 742 | 737 |
if is_service_enabled tls-proxy; then |
| 743 | 738 |
# Set the service port for a proxy to take the original |
| ... | ... |
@@ -522,12 +522,8 @@ function create_nova_conf {
|
| 522 | 522 |
iniset $NOVA_CONF DEFAULT force_config_drive "$FORCE_CONFIG_DRIVE" |
| 523 | 523 |
fi |
| 524 | 524 |
# Format logging |
| 525 |
- if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ] && [ "$NOVA_USE_MOD_WSGI" == "False" ] ; then |
|
| 526 |
- setup_colorized_logging $NOVA_CONF |
|
| 527 |
- else |
|
| 528 |
- # Show user_name and project_name instead of user_id and project_id |
|
| 529 |
- iniset $NOVA_CONF DEFAULT logging_user_identity_format "%(user_name)s %(project_name)s" |
|
| 530 |
- fi |
|
| 525 |
+ setup_logging $NOVA_CONF $NOVA_USE_MOD_WSGI |
|
| 526 |
+ |
|
| 531 | 527 |
if [ "$NOVA_USE_MOD_WSGI" == "True" ]; then |
| 532 | 528 |
_config_nova_apache_wsgi |
| 533 | 529 |
fi |