From 5b72e598a5caf05b2acfee5952b47643478714c5 Mon Sep 17 00:00:00 2001 From: Scott Koranda Date: Mon, 30 Apr 2018 08:11:22 -0500 Subject: [PATCH] Better logging for COmanage Registry component Removed the Dockerfile instruction that edited bootstrap.php and swapped in ConsoleLog for FileLog. Instead the FileLog will remain but now the entry point script sets up pipes instead of those log files and then spawns child processes that use cat and awk to format the log entries as specified for TIER packaged components. --- comanage-registry-internet2-tier/Dockerfile | 3 +-- .../docker-comanage-entrypoint | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/comanage-registry-internet2-tier/Dockerfile b/comanage-registry-internet2-tier/Dockerfile index 0c56c72..b01f63c 100644 --- a/comanage-registry-internet2-tier/Dockerfile +++ b/comanage-registry-internet2-tier/Dockerfile @@ -128,8 +128,7 @@ RUN mkdir -p "${COMANAGE_REGISTRY_DIR}" \ && cd /var/www/html \ && ln -s ${COMANAGE_REGISTRY_DIR}/app/webroot registry \ && rm -rf ${COMANAGE_REGISTRY_DIR}/local/* \ - && ln -s ${COMANAGE_REGISTRY_DIR}/local /local \ - && sed -ie 's/'"'"'engine'"'"' => '"'"'FileLog'"'"'/'"'"'engine'"'"' => '"'"'ConsoleLog'"'"'/' "$COMANAGE_REGISTRY_DIR/app/Config/bootstrap.php" + && ln -s ${COMANAGE_REGISTRY_DIR}/local /local COPY 000-comanage.conf /etc/httpd/conf.d/ COPY 10-php7.conf /etc/httpd/conf.modules.d/ diff --git a/comanage-registry-internet2-tier/docker-comanage-entrypoint b/comanage-registry-internet2-tier/docker-comanage-entrypoint index 901f4fd..ba378a4 100755 --- a/comanage-registry-internet2-tier/docker-comanage-entrypoint +++ b/comanage-registry-internet2-tier/docker-comanage-entrypoint @@ -281,4 +281,13 @@ fi # Configure Apache HTTP Server with the server name. sed -i -e s@%%SERVER_NAME%%@"${SERVER_NAME:-unknown}"@g /etc/httpd/conf.d/000-comanage.conf +# Create pipes to use for COmanage Registry instead of standard log files. +mkfifo -m 666 /srv/comanage-registry/app/tmp/logs/error.log +mkfifo -m 666 /srv/comanage-registry/app/tmp/logs/debug.log + +# Format any output from COmanange Registry into standard TIER form. +(cat <> /srv/comanage-registry/app/tmp/logs/error.log | awk -v ENV="$ENV" -v UT="$USERTOKEN" '{printf "COmanage Registry error.log %s %s %s\n", ENV, UT, $0; fflush()}' 1>/dev/stdout)& +(cat <> /srv/comanage-registry/app/tmp/logs/debug.log | awk -v ENV="$ENV" -v UT="$USERTOKEN" '{printf "COmanage Registry debug.log %s %s %s\n", ENV, UT, $0; fflush()}' 1>/dev/stdout)& + +# Start Apache HTTP Server exec /usr/sbin/httpd -DFOREGROUND