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

View File

@ -75,7 +75,7 @@ function gen_config {
# Create a logging config file to dump everything to stdout/stderr.
cat <<EOCONF > $CONF_DIR/logging.conf
[loggers]
keys = root, deckhand
keys = root, deckhand, error
[handlers]
keys = null, stderr, stdout
@ -88,6 +88,10 @@ level = DEBUG
handlers = stdout
qualname = deckhand
[logger_error]
level = ERROR
handlers = stderr
[logger_root]
level = WARNING
handlers = null
@ -118,9 +122,6 @@ EOCONF
cat <<EOCONF > $CONF_DIR/deckhand.conf
[DEFAULT]
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
use_stderr = true
# NOTE: allow_anonymous_access allows these functional tests to get around
@ -148,6 +149,12 @@ connection = $DATABASE_URL
# auth_type = password
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
cat $CONF_DIR/deckhand.conf 1>&2
@ -185,10 +192,8 @@ gen_config
gen_paste
gen_policy
log_section Starting Deckhand image
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.
uwsgi \
@ -201,7 +206,7 @@ if [ -z "$DECKHAND_IMAGE" ]; then
-L \
--pyargv "--config-file $CONF_DIR/deckhand.conf" &> $STDOUT &
else
echo "Running Deckhand via Docker"
log_section "Running Deckhand via Docker"
sudo docker run \
--rm \
--net=host \