unify logging setup on all services
This provides a single setup_logging function which builds consistent
colorization if the config supports it, otherwise builds the identity
strings that we need to actually keep track of requests.
Change-Id: Iffe30326a5b974ad141aed6288f61e0d6fd18ca9
diff --git a/lib/cinder b/lib/cinder
index cf5bb25..870ee0b 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -333,12 +333,7 @@
iniset $CINDER_CONF DEFAULT volume_clear $CINDER_VOLUME_CLEAR
# Format logging
- if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ] && [ "$CINDER_USE_MOD_WSGI" == "False" ]; then
- setup_colorized_logging $CINDER_CONF
- else
- # Set req-id, project-name and resource in log format
- 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"
- fi
+ setup_logging $CINDER_CONF $CINDER_USE_MOD_WSGI
if [ "$CINDER_USE_MOD_WSGI" == "True" ]; then
_cinder_config_apache_wsgi
diff --git a/lib/glance b/lib/glance
index 1736114..26c4150 100644
--- a/lib/glance
+++ b/lib/glance
@@ -229,10 +229,8 @@
fi
# Format logging
- if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
- setup_colorized_logging $GLANCE_API_CONF
- setup_colorized_logging $GLANCE_REGISTRY_CONF
- fi
+ setup_logging $GLANCE_API_CONF
+ setup_logging $GLANCE_REGISTRY_CONF
cp -p $GLANCE_DIR/etc/glance-registry-paste.ini $GLANCE_REGISTRY_PASTE_INI
@@ -273,7 +271,7 @@
if is_service_enabled g-glare; then
local dburl
dburl=`database_connection_url glance`
- setup_colorized_logging $GLANCE_GLARE_CONF
+ setup_logging $GLANCE_GLARE_CONF
iniset $GLANCE_GLARE_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
iniset $GLANCE_GLARE_CONF DEFAULT bind_host $GLANCE_SERVICE_LISTEN_ADDRESS
iniset $GLANCE_GLARE_CONF DEFAULT bind_port $GLANCE_GLARE_PORT
diff --git a/lib/neutron-legacy b/lib/neutron-legacy
index cf59b2d..5ec61f9 100644
--- a/lib/neutron-legacy
+++ b/lib/neutron-legacy
@@ -732,12 +732,7 @@
fi
# Format logging
- if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
- setup_colorized_logging $NEUTRON_CONF
- else
- # Show user_name and project_name by default like in nova
- iniset $NEUTRON_CONF DEFAULT logging_user_identity_format "%(user_name)s %(project_name)s"
- fi
+ setup_logging $NEUTRON_CONF
if is_service_enabled tls-proxy; then
# Set the service port for a proxy to take the original
diff --git a/lib/nova b/lib/nova
index 617cf5c..c47f81a 100644
--- a/lib/nova
+++ b/lib/nova
@@ -519,12 +519,8 @@
iniset $NOVA_CONF DEFAULT force_config_drive "$FORCE_CONFIG_DRIVE"
fi
# Format logging
- if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ] && [ "$NOVA_USE_MOD_WSGI" == "False" ] ; then
- setup_colorized_logging $NOVA_CONF
- else
- # Show user_name and project_name instead of user_id and project_id
- iniset $NOVA_CONF DEFAULT logging_user_identity_format "%(user_name)s %(project_name)s"
- fi
+ setup_logging $NOVA_CONF $NOVA_USE_MOD_WSGI
+
if [ "$NOVA_USE_MOD_WSGI" == "True" ]; then
_config_nova_apache_wsgi
fi