From 95b994d54815027904504cf173451cd87fd99c66 Mon Sep 17 00:00:00 2001
From: John Griffith <john.griffith8@gmail.com>
Date: Sat, 18 Apr 2015 11:20:15 -0600
Subject: [PATCH] Add logging config to cinder.conf

Part of the effort to clean up the Cinder logs is to use
the resource tag in the log format.  We also want to have
some consistency with other projects in how we do logging.

This change adds the logging format to cinder.conf similar to
what Nova and others use, and most importantly turns on the use
of the resource tag that's in olso_log.

We're slowly cleaning up the logging in Cinder by doing things
like replacing "Delete volume %(volume_id)s compoleted" with
("Delete volume completed successfully.", resource=volume)

It woudl be good to have these picked up as we transition so we're
not missing info.  Also, there's sure to be cases where "volume"
isn't a valid dbref and we find issues that need fixed.

Change-Id: I193637fea14d97183f6a9782f37d8edcf929e0c4
---
 lib/cinder | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/cinder b/lib/cinder
index de41bc5f79..6439903953 100644
--- a/lib/cinder
+++ b/lib/cinder
@@ -264,6 +264,9 @@ function configure_cinder {
     # Format logging
     if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
         setup_colorized_logging $CINDER_CONF DEFAULT "project_id" "user_id"
+    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
 
     if [[ -r $CINDER_PLUGINS/$CINDER_DRIVER ]]; then