Skip to content

Commit c3a59e6

Browse files
committed
[XEN-3155] fix entrypoint scripts failing the json logging test because they do not report the correct fields for an application type log
1 parent 29bb882 commit c3a59e6

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

tomcat-base/src/shared/main/bash/entrypoint/docker-entrypoint.d/80-java-opts.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fi
3434
IFS=$'\n'
3535
for I in $(env); do
3636
if [[ $I == JAVA_OPTS_* ]]; then
37-
echo '{ "timestamp" : '"$(date '+%s')"' ,"severity" : "INFO", "type" : "application","component" : "docker-entrypoint" ,"fullMessage" : "' "-- collecting $I" '"}'
37+
echo '{ "timestamp" : '"$(date '+%s')"' ,"severity" : "INFO", "type" : "entrypoint","component" : "docker-entrypoint" ,"fullMessage" : "' "-- collecting $I" '"}'
3838
VALUE=$(echo $I | cut -d '=' -f 2-)
3939
JAVA_OPTS="$JAVA_OPTS $VALUE"
4040
fi
@@ -43,4 +43,4 @@ done
4343
# Trim leading/trailing whitespace
4444
export JAVA_OPTS=$(echo $JAVA_OPTS | xargs echo)
4545

46-
echo '{ "timestamp" : '"$(date '+%s')"' ,"severity" : "INFO", "type" : "application","component" : "docker-entrypoint" ,"fullMessage" : "' "Result: JAVA_OPTS=${JAVA_OPTS}" '"}'
46+
echo '{ "timestamp" : '"$(date '+%s')"' ,"severity" : "INFO", "type" : "entrypoint","component" : "docker-entrypoint" ,"fullMessage" : "' "Result: JAVA_OPTS=${JAVA_OPTS}" '"}'

tomcat-base/src/shared/main/bash/entrypoint/docker-entrypoint.d/89-check-validity.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
currentDate=$(date +%s)
44
if [ -z "${BUILD_DATE}" ]; then
5-
echo '{ "timestamp" : '"$(date -d @$currentDate +"%s")"' ,"severity" : "WARN", "type" : "application","component" : "docker-entrypoint" ,"fullMessage" : "Unable to determine image age: BUILD_DATE is not set"}'
5+
echo '{ "timestamp" : '"$(date -d @$currentDate +"%s")"' ,"severity" : "WARN", "type" : "entrypoint","component" : "docker-entrypoint" ,"fullMessage" : "Unable to determine image age: BUILD_DATE is not set"}'
66
else
77
printf -v buildDate "%.0f\n" "$BUILD_DATE"
88
timeelapsed=$(expr ${currentDate} - ${buildDate})
99
if [ $timeelapsed -ge 2592000 ]; then # 30 days
10-
echo '{ "timestamp" : '"$(date -d @$currentDate +"%s")"' ,"severity" : "WARN", "type" : "application","component" : "docker-entrypoint" , "fullMessage" : "This is an old image: BUILD_DATE='"$(date -d @$BUILD_DATE +"%Y-%m-%d %H:%M:%S")"' and currentDate='"$(date -d @$currentDate +"%Y-%m-%d %H:%M:%S")"'"}'
10+
echo '{ "timestamp" : '"$(date -d @$currentDate +"%s")"' ,"severity" : "WARN", "type" : "entrypoint","component" : "docker-entrypoint" , "fullMessage" : "This is an old image: BUILD_DATE='"$(date -d @$BUILD_DATE +"%Y-%m-%d %H:%M:%S")"' and currentDate='"$(date -d @$currentDate +"%Y-%m-%d %H:%M:%S")"'"}'
1111
fi
1212
fi

tomcat-base/src/shared/main/bash/entrypoint/docker-entrypoint.d/90-logging-env-vars.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set -e
55
# LOG_LEVEL_ environment variables and tells the Java process to use it.
66

77
function log() {
8-
echo '{ "timestamp" : '"$(date '+%s')"' ,"severity" : "INFO", "type" : "application","component" : "docker-entrypoint" ,"fullMessage" : "'"$1"'"}'
8+
echo '{ "timestamp" : '"$(date '+%s')"' ,"severity" : "INFO", "type" : "entrypoint","component" : "docker-entrypoint" ,"fullMessage" : "'"$1"'"}'
99
}
1010

1111
if [ "$LOG4J_VERSION" = "1" ]; then

tomcat-base/src/shared/main/bash/entrypoint/docker-entrypoint.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ DIR=/docker-entrypoint.d
55
if [[ -d "$DIR" ]]
66
then
77
for SCRIPT in ${DIR}/*; do
8-
echo '{ "timestamp" : '"$(date '+%s')"' ,"severity" : "INFO", "type" : "application","component" : "docker-entrypoint" ,"fullMessage" : "> Executing'"${SCRIPT}"'"}'
8+
echo '{ "timestamp" : '"$(date '+%s')"' ,"severity" : "INFO", "type" : "entrypoint","component" : "docker-entrypoint" ,"fullMessage" : "> Executing'"${SCRIPT}"'"}'
99
. "$SCRIPT"
1010
done
1111
fi
12-
echo '{ "timestamp" : '"$(date '+%s')"' ,"severity" : "INFO", "type" : "application","component" : "docker-entrypoint" ,"fullMessage" : "'"> Starting CMD: $@"'"}'
13-
echo '{ "timestamp" : '"$(date '+%s')"' ,"severity" : "INFO", "type" : "application","component" : "docker-entrypoint" ,"fullMessage" : "> exec '"$(eval eval echo $@)"'"}'
12+
echo '{ "timestamp" : '"$(date '+%s')"' ,"severity" : "INFO", "type" : "entrypoint","component" : "docker-entrypoint" ,"fullMessage" : "'"> Starting CMD: $@"'"}'
13+
echo '{ "timestamp" : '"$(date '+%s')"' ,"severity" : "INFO", "type" : "entrypoint","component" : "docker-entrypoint" ,"fullMessage" : "> exec '"$(eval eval echo $@)"'"}'
1414
# first 'eval' expands variables (like $JAVA_OPTS) in $@
1515
# second 'eval' flattens arguments, so that $JAVA_OPTS expanded into is not seen as a single argument (DOCKER-136)
1616
# which enables us to use exec-form with $JAVA_OPTS support:

0 commit comments

Comments
 (0)