Cleanup of nodepool builder logging

We can use textwrap to break up the ridiculously long lines in the
logging configuration (with less images, it's less ridiculous than it
used to be, but it's still easier to parse).  Only trick is to put
spaces between the arguments to give it somewhere to split (and better
for readability) and stop it splitting on words/hyphens.

Change-Id: I04840e98b0564dc531b74b96e8595f9d18b284af
This commit is contained in:
Ian Wienand 2016-02-04 10:46:56 +11:00
parent 50d2b4ac53
commit 968f09bfa9
2 changed files with 29 additions and 42 deletions

View File

@ -6,10 +6,24 @@
# #
[loggers] [loggers]
keys=root,nodepool,requests,shade,image,rax-dfw_bare-precise,rax-dfw_devstack-trusty,rax-dfw_bare-trusty,rax-dfw_devstack-centos7,rax-ord_bare-precise,rax-ord_devstack-trusty,rax-ord_bare-trusty,rax-ord_devstack-centos7,rax-iad_bare-precise,rax-iad_devstack-trusty,rax-iad_bare-trusty,rax-iad_devstack-centos7,tripleo-test-cloud-rh1_tripleo-f22,dib_debian-jessie,dib_ubuntu-trusty,dib_devstack-trusty,dib_devstack-centos7,dib_centos-7,dib_fedora-23 keys=root,nodepool,requests,shade,image,
rax-dfw_bare-precise, rax-dfw_devstack-trusty,
rax-dfw_devstack-centos7, rax-ord_bare-precise,
rax-ord_devstack-trusty, rax-ord_devstack-centos7,
rax-iad_bare-precise, rax-iad_devstack-trusty,
rax-iad_devstack-centos7, tripleo-test-cloud-rh1_tripleo-f22,
dib_debian-jessie, dib_ubuntu-trusty, dib_devstack-trusty,
dib_devstack-centos7, dib_centos-7, dib_fedora-23
[handlers] [handlers]
keys=console,debug,normal,image,rax-dfw_bare-precise,rax-dfw_devstack-trusty,rax-dfw_bare-trusty,rax-dfw_devstack-centos7,rax-ord_bare-precise,rax-ord_devstack-trusty,rax-ord_bare-trusty,rax-ord_devstack-centos7,rax-iad_bare-precise,rax-iad_devstack-trusty,rax-iad_bare-trusty,rax-iad_devstack-centos7,tripleo-test-cloud-rh1_tripleo-f22,dib_debian-jessie,dib_ubuntu-trusty,dib_devstack-trusty,dib_devstack-centos7,dib_centos-7,dib_fedora-23 keys=console,debug,normal,image,
rax-dfw_bare-precise, rax-dfw_devstack-trusty,
rax-dfw_devstack-centos7, rax-ord_bare-precise,
rax-ord_devstack-trusty, rax-ord_devstack-centos7,
rax-iad_bare-precise, rax-iad_devstack-trusty,
rax-iad_devstack-centos7, tripleo-test-cloud-rh1_tripleo-f22,
dib_debian-jessie, dib_ubuntu-trusty, dib_devstack-trusty,
dib_devstack-centos7, dib_centos-7, dib_fedora-23
[formatters] [formatters]
keys=simple keys=simple
@ -94,18 +108,6 @@ class=logging.handlers.TimedRotatingFileHandler
formatter=simple formatter=simple
args=('<%= @image_log_document_root %>/rax-dfw.devstack-trusty.log', 'H', 8, 30,) args=('<%= @image_log_document_root %>/rax-dfw.devstack-trusty.log', 'H', 8, 30,)
[logger_rax-dfw_bare-trusty]
level=DEBUG
handlers=rax-dfw_bare-trusty
qualname=nodepool.image.build.rax-dfw.bare-trusty
propagate=0
[handler_rax-dfw_bare-trusty]
level=DEBUG
class=logging.handlers.TimedRotatingFileHandler
formatter=simple
args=('<%= @image_log_document_root %>/rax-dfw.bare-trusty.log', 'H', 8, 30,)
[logger_rax-dfw_devstack-centos7] [logger_rax-dfw_devstack-centos7]
level=DEBUG level=DEBUG
handlers=rax-dfw_devstack-centos7 handlers=rax-dfw_devstack-centos7
@ -142,18 +144,6 @@ class=logging.handlers.TimedRotatingFileHandler
formatter=simple formatter=simple
args=('<%= @image_log_document_root %>/rax-ord.devstack-trusty.log', 'H', 8, 30,) args=('<%= @image_log_document_root %>/rax-ord.devstack-trusty.log', 'H', 8, 30,)
[logger_rax-ord_bare-trusty]
level=DEBUG
handlers=rax-ord_bare-trusty
qualname=nodepool.image.build.rax-ord.bare-trusty
propagate=0
[handler_rax-ord_bare-trusty]
level=DEBUG
class=logging.handlers.TimedRotatingFileHandler
formatter=simple
args=('<%= @image_log_document_root %>/rax-ord.bare-trusty.log', 'H', 8, 30,)
[logger_rax-ord_devstack-centos7] [logger_rax-ord_devstack-centos7]
level=DEBUG level=DEBUG
handlers=rax-ord_devstack-centos7 handlers=rax-ord_devstack-centos7
@ -190,18 +180,6 @@ class=logging.handlers.TimedRotatingFileHandler
formatter=simple formatter=simple
args=('<%= @image_log_document_root %>/rax-iad.devstack-trusty.log', 'H', 8, 30,) args=('<%= @image_log_document_root %>/rax-iad.devstack-trusty.log', 'H', 8, 30,)
[logger_rax-iad_bare-trusty]
level=DEBUG
handlers=rax-iad_bare-trusty
qualname=nodepool.image.build.rax-iad.bare-trusty
propagate=0
[handler_rax-iad_bare-trusty]
level=DEBUG
class=logging.handlers.TimedRotatingFileHandler
formatter=simple
args=('<%= @image_log_document_root %>/rax-iad.bare-trusty.log', 'H', 8, 30,)
[logger_rax-iad_devstack-centos7] [logger_rax-iad_devstack-centos7]
level=DEBUG level=DEBUG
handlers=rax-iad_devstack-centos7 handlers=rax-iad_devstack-centos7

View File

@ -24,6 +24,7 @@ builds and applys some sensible rotation defaults.
import argparse import argparse
import logging import logging
import textwrap
import yaml import yaml
# default paths and outputs # default paths and outputs
@ -43,10 +44,12 @@ _BASIC_FILE = """
# #
[loggers] [loggers]
keys=root,nodepool,requests,shade,image,%(logger_titles)s keys=root,nodepool,requests,shade,image,
%(logger_titles)s
[handlers] [handlers]
keys=console,debug,normal,image,%(handler_titles)s keys=console,debug,normal,image,
%(handler_titles)s
[formatters] [formatters]
keys=simple keys=simple
@ -217,8 +220,14 @@ def generate_log_config(config, log_dir, image_log_dir, output):
final_output = _BASIC_FILE % { final_output = _BASIC_FILE % {
'log_dir': log_dir, 'log_dir': log_dir,
'image_log_dir': image_log_dir, 'image_log_dir': image_log_dir,
'logger_titles': ','.join(logger_titles), 'logger_titles': "\n".join(textwrap.wrap(', '.join(logger_titles),
'handler_titles': ','.join(handler_titles), break_long_words=False,
break_on_hyphens=False,
subsequent_indent=' ')),
'handler_titles': "\n".join(textwrap.wrap(', '.join(handler_titles),
break_long_words=False,
break_on_hyphens=False,
subsequent_indent=' ')),
'image_loggers_and_handlers': image_loggers_and_handlers, 'image_loggers_and_handlers': image_loggers_and_handlers,
} }