forked from sovity/edc-ce
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: debug logging and remote debugging (sovity#790)
- Loading branch information
1 parent
9cd6484
commit 49e3888
Showing
6 changed files
with
73 additions
and
1 deletion.
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 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 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,43 @@ | ||
#!/usr/bin/env bash | ||
# Use bash instead of sh, | ||
# because sh in this image is provided by dash (https://git.kernel.org/pub/scm/utils/dash/dash.git/), | ||
# which seems to eat environment variables containing dashes, | ||
# which are required for some EDC configuration values. | ||
|
||
# Do not set -u to permit unset variables in .env | ||
set -eo pipefail | ||
|
||
# Apply ENV Vars on JAR startup | ||
set -a | ||
source /app/.env | ||
set +a | ||
|
||
|
||
if [[ "x${1:-}" == "xstart" ]]; then | ||
cmd=(java ${JAVA_ARGS:-}) | ||
|
||
if [ "${REMOTE_DEBUG:-n}" = "y" ] || [ "${REMOTE_DEBUG:-false}" = "true" ]; then | ||
cmd+=( | ||
"-agentlib:jdwp=transport=dt_socket,server=y,suspend=${REMOTE_DEBUG_SUSPEND:-n},address=${REMOTE_DEBUG_BIND:-127.0.0.1:5005}" | ||
) | ||
fi | ||
|
||
logging_config='/app/logging.properties' | ||
if [ "${DEBUG_LOGGING:-n}" = "y" ] || [ "${DEBUG_LOGGING:-false}" = "true" ]; then | ||
logging_config='/app/logging.dev.properties' | ||
fi | ||
|
||
cmd+=( | ||
-Djava.util.logging.config.file=${logging_config} | ||
-jar /app/app.jar | ||
) | ||
else | ||
cmd=("$@") | ||
fi | ||
|
||
if [ "${REMOTE_DEBUG:-n}" = "y" ] || [ "${REMOTE_DEBUG:-false}" = "true" ]; then | ||
echo "Jar CMD (printing, because REMOTE_DEBUG=y|true): ${cmd[@]}" | ||
fi | ||
|
||
# Use "exec" for termination signals to reach JVM | ||
exec "${cmd[@]}" |
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,7 @@ | ||
handlers = java.util.logging.ConsoleHandler | ||
.level = FINE | ||
java.util.logging.ConsoleHandler.level = ALL | ||
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter | ||
java.util.logging.SimpleFormatter.format = %1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS %5$s %6$s%n | ||
org.eclipse.dataspaceconnector.level = FINE | ||
org.eclipse.dataspaceconnector.handler = java.util.logging.ConsoleHandler |