Skip to content

Commit

Permalink
Added logging to file to the startup scripts [#515]
Browse files Browse the repository at this point in the history
 * Updated the QUICKSTART.md file to reflect the changes.
  • Loading branch information
mcpierce committed Sep 24, 2020
1 parent f9fc564 commit b637baf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
2 changes: 1 addition & 1 deletion QUICKSTART.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Sometimes you might want (or need) to capture some additional information to rep

To capture the logging to a file, you can add the following commandline option:
```
$ java -jar [path to your JAR file] --logging.file=comixed.log
$ java -jar [path to your JAR file] --logging.file.name=comixed.log
```

## Logging In And Configuring Your Account
Expand Down
12 changes: 12 additions & 0 deletions comixed-release/src/main/assembly/scripts/run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ IF "%PARAM%" == "-u" GOTO set_jdbc_user
IF "%PARAM%" == "-p" GOTO set_jdbc_pwrd
IF "%PARAM%" == "-i" GOTO set_image_cache_dir
if "%PARAM%" == "-l" GOTO set_lib_dir
IF "%PARAM%" == "-L" GOTO set_logging_file
GOTO process_command_line

:set_jdbc_url
Expand Down Expand Up @@ -64,6 +65,12 @@ SHIFT
SHIFT
GOTO process_command_line

:set_logging_file
SET LOGFILE=%ARG%
SHIFT
SHIFT
GOTO process_command_line

:show_help
ECHO Usage: run.bat [OPTIONS]
ECHO.
Expand All @@ -77,6 +84,7 @@ ECHO.
ECHO OTHER OPTIONS:
ECHO -d - Enable debugging (def. off)
ECHO -D - Turn on ALL debugging (def. off)
ECHO -L [LOGFILE] - Write logs to a logfile
ECHO -h - Show help (this text)
GOTO exit_script

Expand All @@ -92,6 +100,10 @@ IF "%FULLDEBUG%" == "" GOTO skip_full_debug
SET OPTIONS=%OPTIONS% --logging.level.root=DEBUG
:skip_full_debug

IF "%LOGFILE%" == "" GOTO :skip_logfile
SET OPTIONS=%OPTIONS% --logging.file.name=%LOGFILE%
:skip_logfile

IF "%JDBCURL%" == "" GOTO skip_jdbc_url
SET OPTIONS=%OPTIONS% --spring.datasource.url=%JDBCURL%
:skip_jdbc_url
Expand Down
15 changes: 11 additions & 4 deletions comixed-release/src/main/assembly/scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ JDBCURL=""
DBUSER=""
DBPWRD=""
IMGCACHEDIR=""
LOGFILE=""

usage() {
echo "Usage: run.sh [OPTIONS]"
Expand All @@ -43,13 +44,14 @@ usage() {
echo " -l [DIR]\t\t-Set the JAR library directory"
echo ""
echo "Other options:"
echo " -d\t\t\t- Debug mode (def. false)"
echo " -D\t\t\t- Turn on ALL debugging (def. false)"
echo " -v\t\t\t- Verbose mode (def. false)"
echo " -d - Debug mode (def. false)"
echo " -D - Turn on ALL debugging (def. false)"
echo " -v - Verbose mode (def. false)"
echo " -L [LOGFILE] - Write logs to a file"
exit 0
}

while getopts "j:u:p:i:l:dDv" option; do
while getopts "j:u:p:i:l:dDvL:" option; do
case ${option} in
j) JDBCURL="${OPTARG}" ;;
u) DBUSER="${OPTARG}" ;;
Expand All @@ -59,6 +61,7 @@ while getopts "j:u:p:i:l:dDv" option; do
d) DEBUG=true ;;
D) FULL_DEBUG=true ;;
v) VERBOSE=true ;;
L) LOGFILE="${OPTARG}" ;;
\?) usage ;;
esac
done
Expand All @@ -82,6 +85,10 @@ if $FULL_DEBUG; then
JAROPTIONS="${JAROPTIONS} --logging.level.root=DEBUG"
fi

if [[ $LOGFILE ]]; then
JAROPTIONS="${JAROPTIONS} --logging.file.name=${LOGFILE}"
fi

if [[ $JDBCURL ]]; then
JAROPTIONS="${JAROPTIONS} --spring.datasource.url=${JDBCURL}"
fi
Expand Down

0 comments on commit b637baf

Please sign in to comment.