Merge pull request #112 from opencultureconsulting/45-run-server-log-in-error-msg

run: print 50 lines of server log
This commit is contained in:
Felix Lohmeier 2023-10-26 07:16:36 +02:00 committed by GitHub
commit 9ba1c7f067
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 6 deletions

10
orcli
View File

@ -1077,6 +1077,12 @@ function error() {
echo >&2 "[$(date +'%Y-%m-%dT%H:%M:%S')] ERROR: $1" echo >&2 "[$(date +'%Y-%m-%dT%H:%M:%S')] ERROR: $1"
shift shift
for msg in "$@"; do echo >&2 " $msg"; done for msg in "$@"; do echo >&2 " $msg"; done
if [[ -f "$OPENREFINE_TMPDIR/openrefine.log" ]]; then
echo >&2 "last 50 lines of OpenRefine's server log:"
echo >&2 "-----------------------------------------"
tail >&2 -50 "$OPENREFINE_TMPDIR/openrefine.log"
echo >&2 "-----------------------------------------"
fi
exit 1 exit 1
} }
function log() { function log() {
@ -1572,7 +1578,7 @@ orcli_test_command() {
break break
fi fi
if [[ $i == 20 ]]; then if [[ $i == 20 ]]; then
error "starting OpenRefine server failed!" "$(cat "$OPENREFINE_TMPDIR/openrefine.log")" error "starting OpenRefine server failed!""
fi fi
done done
@ -1864,7 +1870,7 @@ orcli_run_command() {
break break
fi fi
if [[ $i == 20 ]]; then if [[ $i == 20 ]]; then
error "starting OpenRefine server failed!" "$(cat "$OPENREFINE_TMPDIR/openrefine.log")" error "starting OpenRefine server failed!"
fi fi
done done

View File

@ -4,6 +4,12 @@ function error() {
echo >&2 "[$(date +'%Y-%m-%dT%H:%M:%S')] ERROR: $1" echo >&2 "[$(date +'%Y-%m-%dT%H:%M:%S')] ERROR: $1"
shift shift
for msg in "$@"; do echo >&2 " $msg"; done for msg in "$@"; do echo >&2 " $msg"; done
if [[ -f "$OPENREFINE_TMPDIR/openrefine.log" ]]; then
echo >&2 "last 50 lines of OpenRefine's server log:"
echo >&2 "-----------------------------------------"
tail >&2 -50 "$OPENREFINE_TMPDIR/openrefine.log"
echo >&2 "-----------------------------------------"
fi
exit 1 exit 1
} }
function log() { function log() {

View File

@ -62,7 +62,7 @@ for i in {1..20}; do
break break
fi fi
if [[ $i == 20 ]]; then if [[ $i == 20 ]]; then
error "starting OpenRefine server failed!" "$(cat "$OPENREFINE_TMPDIR/openrefine.log")" error "starting OpenRefine server failed!"
fi fi
done done

View File

@ -42,7 +42,7 @@ for i in {1..20}; do
break break
fi fi
if [[ $i == 20 ]]; then if [[ $i == 20 ]]; then
error "starting OpenRefine server failed!" "$(cat "$OPENREFINE_TMPDIR/openrefine.log")" error "starting OpenRefine server failed!"
fi fi
done done