Update Deckhand image: logging configuration values.

This is to update the logging values that get provided to logging.conf
to be in line with logging in containers: outputting logging messages
to stdout and stderr.

Change-Id: Ib780a35c51cb6ba0cbb66ee8b2ea1836b83b9a61
This commit is contained in:
Felipe Monteiro 2018-01-11 04:20:15 +00:00
parent 57eb8295cf
commit 7e460e0f8a
2 changed files with 28 additions and 17 deletions

View File

@ -216,7 +216,6 @@ conf:
deckhand: deckhand:
DEFAULT: DEFAULT:
debug: true debug: true
log_file: deckhand.log
use_stderr: true use_stderr: true
use_syslog: true use_syslog: true
database: database:
@ -232,27 +231,34 @@ conf:
policy_dirs: policy.d policy_dirs: policy.d
logging: logging:
loggers: loggers:
keys: 'root, deckhand' keys: 'root, deckhand, error'
handlers: handlers:
keys: 'file, null, syslog' keys: 'null, stderr, stdout, syslog'
formatters: formatters:
keys: 'simple, context' keys: 'simple, context'
logger_deckhand: logger_deckhand:
level: DEBUG level: DEBUG
handlers: file handlers: stdout
qualname: deckhand
logger_error:
level: ERROR
handlers: stderr
qualname: deckhand qualname: deckhand
logger_root: logger_root:
level: WARNING level: WARNING
handlers: null handlers: null
handler_file:
class: FileHandler
level: DEBUG
args: "('deckhand.log', 'w+')"
formatter: context
handler_null: handler_null:
class: 'logging.NullHandler' class: 'logging.NullHandler'
formatter: context formatter: context
args: '()' args: '()'
handler_stderr:
class: StreamHandler
args: '(sys.stderr,)'
formatter: context
handler_stdout:
class: StreamHandler
args: '(sys.stdout,)'
formatter: context
handler_syslog: handler_syslog:
class: 'handlers.SysLogHandler' class: 'handlers.SysLogHandler'
level: ERROR level: ERROR

View File

@ -75,7 +75,7 @@ function gen_config {
# Create a logging config file to dump everything to stdout/stderr. # Create a logging config file to dump everything to stdout/stderr.
cat <<EOCONF > $CONF_DIR/logging.conf cat <<EOCONF > $CONF_DIR/logging.conf
[loggers] [loggers]
keys = root, deckhand keys = root, deckhand, error
[handlers] [handlers]
keys = null, stderr, stdout keys = null, stderr, stdout
@ -88,6 +88,10 @@ level = DEBUG
handlers = stdout handlers = stdout
qualname = deckhand qualname = deckhand
[logger_error]
level = ERROR
handlers = stderr
[logger_root] [logger_root]
level = WARNING level = WARNING
handlers = null handlers = null
@ -118,9 +122,6 @@ EOCONF
cat <<EOCONF > $CONF_DIR/deckhand.conf cat <<EOCONF > $CONF_DIR/deckhand.conf
[DEFAULT] [DEFAULT]
debug = true debug = true
# NOTE: Use the location of this file inside the mounted volume in the
# container.
log_config_append = /etc/deckhand/logging.conf
publish_errors = true publish_errors = true
use_stderr = true use_stderr = true
# NOTE: allow_anonymous_access allows these functional tests to get around # NOTE: allow_anonymous_access allows these functional tests to get around
@ -148,6 +149,12 @@ connection = $DATABASE_URL
# auth_type = password # auth_type = password
EOCONF EOCONF
# Only set up logging if running Deckhand via uwsgi. The container already has
# values for logging.
if [ -z "$DECKHAND_IMAGE" ]; then
sed '1 a log_config_append = '"$CONF_DIR"'/logging.conf' $CONF_DIR/deckhand.conf
fi
echo $CONF_DIR/deckhand.conf 1>&2 echo $CONF_DIR/deckhand.conf 1>&2
cat $CONF_DIR/deckhand.conf 1>&2 cat $CONF_DIR/deckhand.conf 1>&2
@ -185,10 +192,8 @@ gen_config
gen_paste gen_paste
gen_policy gen_policy
log_section Starting Deckhand image
if [ -z "$DECKHAND_IMAGE" ]; then if [ -z "$DECKHAND_IMAGE" ]; then
echo "Running Deckhand via uwsgi" log_section "Running Deckhand via uwsgi"
# Set --workers 2, so that concurrency is always tested. # Set --workers 2, so that concurrency is always tested.
uwsgi \ uwsgi \
@ -201,7 +206,7 @@ if [ -z "$DECKHAND_IMAGE" ]; then
-L \ -L \
--pyargv "--config-file $CONF_DIR/deckhand.conf" &> $STDOUT & --pyargv "--config-file $CONF_DIR/deckhand.conf" &> $STDOUT &
else else
echo "Running Deckhand via Docker" log_section "Running Deckhand via Docker"
sudo docker run \ sudo docker run \
--rm \ --rm \
--net=host \ --net=host \