diff --git a/container_files/tomee/conf/server.xml.loggingpipe b/container_files/tomee/conf/server.xml.loggingpipe new file mode 100644 index 00000000..a69620d8 --- /dev/null +++ b/container_files/tomee/conf/server.xml.loggingpipe @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/container_files/tomee/conf/server.xml.loggingpipe.patch b/container_files/tomee/conf/server.xml.loggingpipe.patch new file mode 100644 index 00000000..d39e03f3 --- /dev/null +++ b/container_files/tomee/conf/server.xml.loggingpipe.patch @@ -0,0 +1,12 @@ +--- server.xml 2020-05-18 15:49:21.192827000 +0000 ++++ server.xml.loggingpipe 2020-05-18 15:52:04.068293000 +0000 +@@ -159,6 +159,9 @@ + ++ + + + diff --git a/container_files/usr-local-bin/librarySetupFilesTomcat.sh b/container_files/usr-local-bin/librarySetupFilesTomcat.sh index 45958862..968d8612 100644 --- a/container_files/usr-local-bin/librarySetupFilesTomcat.sh +++ b/container_files/usr-local-bin/librarySetupFilesTomcat.sh @@ -11,11 +11,15 @@ setupFilesTomcat() { } setupFilesTomcat_accessLogs() { - - if [ "$GROUPER_TOMCAT_LOG_ACCESS" != "true" ]; then - patch /opt/tomee/conf/server.xml /opt/tomee/conf/server.xml.nologging.patch + # first remove existing access logger + patch /opt/tomee/conf/server.xml /opt/tomee/conf/server.xml.nologging.patch + if [ "$GROUPER_TOMCAT_LOG_ACCESS" = "true" ]; then + setupPipe_tomcatAccessLog + + # this patch happens after the last patch + patch /opt/tomee/conf/server.xml /opt/tomee/conf/server.xml.loggingpipe.patch fi } @@ -95,9 +99,11 @@ setupFilesTomcat_loggingSlf4j() { rm -v /opt/tomee/lib/slf4j-api*.jar rm -v /opt/tomee/lib/slf4j-jdk*.jar - rm -v /opt/grouper/grouperWebapp/WEB-INF/lib/slf4j-jdk*.jar cp -v /opt/grouper/grouperWebapp/WEB-INF/lib/slf4j-api-*.jar /opt/tomee/lib - cp -v /opt/grouper/grouperWebapp/WEB-INF/lib/slf4j-log4j*.jar /opt/tomee/lib + # tomee uses the jdk one + cp -v /opt/grouper/grouperWebapp/WEB-INF/lib/slf4j-jdk*.jar /opt/tomee/lib + # grouper uses the log4j one + rm -v /opt/grouper/grouperWebapp/WEB-INF/lib/slf4j-jdk*.jar } diff --git a/container_files/usr-local-bin/librarySetupPipe.sh b/container_files/usr-local-bin/librarySetupPipe.sh index f38412c1..8a5c51ed 100644 --- a/container_files/usr-local-bin/librarySetupPipe.sh +++ b/container_files/usr-local-bin/librarySetupPipe.sh @@ -34,6 +34,11 @@ setupPipe_tomcatLog() { (cat <> /tmp/logtomcat | awk -v ENV="$ENV" -v UT="$USERTOKEN" '{printf "tomee;console;%s;%s;%s\n", ENV, UT, $0; fflush()}' &>/tmp/logpipe) & } +setupPipe_tomcatAccessLog() { + setupPipe /tmp/tomcat_access_log + (cat <> /tmp/tomcat_access_log | awk -v ENV="$ENV" -v UT="$USERTOKEN" '{printf "tomcat-access;console;%s;%s;%s\n", ENV, UT, $0; fflush()}' 1>/tmp/logpipe) & +} + setupPipe_hsqldbLog() { setupPipe /tmp/loghsqldb (cat <> /tmp/loghsqldb | awk -v ENV="$ENV" -v UT="$USERTOKEN" '{printf "hsqldb;console;%s;%s;%s\n", ENV, UT, $0; fflush()}' &>/tmp/logpipe) & @@ -54,6 +59,7 @@ setupPipe_unsetAll() { unset -f setupPipe_shibdLog unset -f setupPipe_supervisordLog unset -f setupPipe_tomcatLog + unset -f setupPipe_tomcatAccessLog unset -f setupPipe_unsetAll } @@ -68,6 +74,7 @@ setupPipe_exportAll() { export -f setupPipe_shibdLog export -f setupPipe_supervisordLog export -f setupPipe_tomcatLog + export -f setupPipe_tomcatAccessLog export -f setupPipe_unsetAll }