Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Merge pull request #32 from docker/180401
add logging functionality, update tomcat
Showing
7 changed files
with
111 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/bin/sh | ||
|
||
#for passed-in env vars, remove spaces and replace any ; with : in usertoken env var since we will use ; as a delimiter | ||
export USERTOKEN="${USERTOKEN//;/:}" | ||
export USERTOKEN="${USERTOKEN// /}" | ||
export ENV="${ENV//;/:}" | ||
export ENV="${ENV// /}" | ||
|
||
# generic console logging pipe for anyone | ||
mkfifo -m 666 /tmp/logpipe | ||
cat <> /tmp/logpipe 1>&2 & | ||
|
||
mkfifo -m 666 /tmp/logcrond | ||
(cat <> /tmp/logcrond | awk -v ENV="$ENV" -v UT="$USERTOKEN" '{printf "crond;console;%s;%s;%s\n", ENV, UT, $0; fflush()}' 1>/tmp/logpipe) & | ||
|
||
mkfifo -m 666 /tmp/logtomcat | ||
(cat <> /tmp/logtomcat | awk -v ENV="$ENV" -v UT="$USERTOKEN" '{printf "tomcat;console;%s;%s;%s\n", ENV, UT, $0; fflush()}' 1>/tmp/logpipe) & | ||
|
||
mkfifo -m 666 /tmp/logsuperd | ||
(cat <> /tmp/logsuperd | awk -v ENV="$ENV" -v UT="$USERTOKEN" '{printf "supervisord;console;%s;%s;%s\n", ENV, UT, $0; fflush()}' 1>/tmp/logpipe) & | ||
|
||
mkfifo -m 666 /tmp/logidp-process | ||
(cat <> /tmp/logidp-process | awk -v ENV="$ENV" -v UT="$USERTOKEN" '{printf "shib-idp;idp-process.log;%s;%s;%s\n", ENV, UT, $0; fflush()}' 1>/tmp/logpipe) & | ||
|
||
mkfifo -m 666 /tmp/logidp-warn | ||
(cat <> /tmp/logidp-warn | awk -v ENV="$ENV" -v UT="$USERTOKEN" '{printf "shib-idp;idp-warn.log;%s;%s;%s\n", ENV, UT, $0; fflush()}' 1>/tmp/logpipe) & | ||
|
||
mkfifo -m 666 /tmp/logidp-audit | ||
(cat <> /tmp/logidp-audit | awk -v ENV="$ENV" -v UT="$USERTOKEN" '{printf "shib-idp;idp-audit.log;%s;%s;%s\n", ENV, UT, $0; fflush()}' 1>/tmp/logpipe) & | ||
|
||
mkfifo -m 666 /tmp/logidp-consent-audit | ||
(cat <> /tmp/logidp-consent-audit | awk -v ENV="$ENV" -v UT="$USERTOKEN" '{printf "shib-idp;idp-consent-audit.log;%s;%s;%s\n", ENV, UT, $0; fflush()}' 1>/tmp/logpipe) & | ||
|
||
|
||
# fix IdP's logback.xml to log to use above pipe | ||
IDP_LOG_CFG_FILE=/opt/shibboleth-idp/conf/logback.xml | ||
if test \! -f ${IDP_LOG_CFG_FILE}.dist; then | ||
cp ${IDP_LOG_CFG_FILE} ${IDP_LOG_CFG_FILE}.dist | ||
fi | ||
sed "s#<File>\${idp.logfiles}/idp-process.log</File>#<File>/tmp/logidp-process</File>#" ${IDP_LOG_CFG_FILE}.dist > ${IDP_LOG_CFG_FILE}.tmp | ||
sed "s#<File>\${idp.logfiles}/idp-warn.log</File>#<File>/tmp/logidp-warn</File>#" ${IDP_LOG_CFG_FILE}.tmp > ${IDP_LOG_CFG_FILE}.tmp2 | ||
sed "s#<File>\${idp.logfiles}/idp-audit.log</File>#<File>/tmp/logidp-audit</File>#" ${IDP_LOG_CFG_FILE}.tmp2 > ${IDP_LOG_CFG_FILE}.tmp3 | ||
sed "s#<File>\${idp.logfiles}/idp-consent-audit.log</File>#<File>/tmp/logidp-consent-audit</File>#" ${IDP_LOG_CFG_FILE}.tmp3 > ${IDP_LOG_CFG_FILE} | ||
rm -f ${IDP_LOG_CFG_FILE}.tmp | ||
rm -f ${IDP_LOG_CFG_FILE}.tmp2 | ||
rm -f ${IDP_LOG_CFG_FILE}.tmp | ||
|
||
#launch supervisord | ||
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,25 @@ | ||
[supervisord] | ||
logfile=/tmp/logsuperd | ||
logfile_maxbytes=0 | ||
loglevel=error | ||
nodaemon=true | ||
user=root | ||
|
||
[program:cron] | ||
command=/usr/sbin/crond -n | ||
autostart=true | ||
autorestart=true | ||
redirect_stderr=true | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile=/tmp/logcrond | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile=/tmp/logcrond | ||
stderr_logfile_maxbytes=0 | ||
directory=/usr/bin | ||
|
||
[program:tomcat] | ||
command=/usr/local/tomcat/bin/catalina.sh run | ||
autostart=true | ||
autorestart=true | ||
redirect_stderr=true | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile=/tmp/logtomcat | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile=/tmp/logtomcat | ||
stderr_logfile_maxbytes=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Configuration status="info"> | ||
<Properties> | ||
<Property name="layout">%d [%t] %-5p %c- %m%n</Property> | ||
</Properties> | ||
<Appenders> | ||
<File name="CATALINA" | ||
fileName="/tmp/logpipe"> | ||
<PatternLayout pattern="tomcat;catalina.out;${env:ENV};${env:USERTOKEN} ${layout}"/> | ||
</File> | ||
<File name="LOCALHOST" | ||
fileName="/tmp/logpipe"> | ||
<PatternLayout pattern="tomcat;localhost.log;${env:ENV};${env:USERTOKEN} ${layout}"/> | ||
</File> | ||
|
||
</Appenders> | ||
<Loggers> | ||
<Root level="info"> | ||
<AppenderRef ref="CATALINA"/> | ||
</Root> | ||
<Logger name="org.apache.catalina.core.ContainerBase.[Catalina].[localhost]" | ||
level="info" additivity="false"> | ||
<AppenderRef ref="LOCALHOST"/> | ||
</Logger> | ||
</Loggers> | ||
</Configuration> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
CLASSPATH=/usr/local/tomcat/bin/* | ||
JAVA_OPTS="-Dlog4j.configurationFile=/usr/local/tomcat/conf/log4j2.xml -DENV=$ENV -DUSERTOKEN=$USERTOKEN" | ||
LOGGING_MANAGER=-Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager | ||
|