Skip to content

Commit

Permalink
Deprecate JAVA_HOME preferring LS_JAVA_HOME (elastic#13207)
Browse files Browse the repository at this point in the history
Adds print of deprecation notices on stdout when Logstash is starting with JAVA_HOME instead of LS_JAVA_HOME
  • Loading branch information
andsel authored Sep 8, 2021
1 parent 728289e commit 3ffdb99
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ If the affected version of Logstash is 7.9 (or earlier), or if it is NOT using t

1. JVM version (`java -version`)
2. JVM installation source (e.g. from the Operating System's package manager, from source, etc).
3. Value of the `JAVA_HOME`/`LS_JAVA_HOME` environment variable if set.
3. Value of the `LS_JAVA_HOME`/`JAVA_HOME` environment variable if set.

**OS version** (`uname -a` if on a Unix-like system):

Expand Down
3 changes: 2 additions & 1 deletion bin/logstash.lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# LS_GEM_HOME and LS_GEM_PATH to overwrite the path assigned to GEM_HOME and GEM_PATH
# LS_JAVA_OPTS to append extra options to the JVM options provided by logstash
# LS_JAVA_HOME to point to the java home (takes precedence over JAVA_HOME)
# JAVA_HOME to point to the java home
# (deprecated) JAVA_HOME to point to the java home

unset CDPATH
# This unwieldy bit of scripting is to try to catch instances where Logstash
Expand Down Expand Up @@ -111,6 +111,7 @@ setup_java() {
else
echo "Invalid JAVA_HOME, doesn't contain bin/java executable."
fi
echo "DEPRECATION: The use of JAVA_HOME is now deprecated and will be removed starting from 8.0. Please configure LS_JAVA_HOME instead."
elif [ -d "${LOGSTASH_HOME}/${BUNDLED_JDK_PART}" -a -x "${LOGSTASH_HOME}/${BUNDLED_JDK_PART}/bin/java" ]; then
echo "Using bundled JDK: ${LOGSTASH_HOME}/${BUNDLED_JDK_PART}"
JAVACMD="${LOGSTASH_HOME}/${BUNDLED_JDK_PART}/bin/java"
Expand Down
1 change: 1 addition & 0 deletions bin/setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ if defined LS_JAVA_HOME (
if exist "%LS_HOME%\jdk" (
echo WARNING: Using JAVA_HOME while Logstash distribution comes with a bundled JDK.
)
echo DEPRECATION: The use of JAVA_HOME is now deprecated and will be removed starting from 8.0. Please configure LS_JAVA_HOME instead.
) else (
if exist "%LS_HOME%\jdk" (
set JAVA="%LS_HOME%\jdk\bin\java.exe"
Expand Down
3 changes: 1 addition & 2 deletions docs/static/jvm.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)
variable must be set for {ls} to operate correctly.

If {ls} doesn't find `LS_JAVA_HOME` it tries to fall back to `JAVA_HOME`.
Note that this fallback behavior is experimental and the usage of `JAVA_HOME`
could be subject to removal in later releases.
The usage of `JAVA_HOME` is now considered deprecated in favor of `LS_JAVA_HOME`.

On some Linux systems, you may need to have the `LS_JAVA_HOME` environment
exported before installing {ls}, particularly if you installed Java from
Expand Down

0 comments on commit 3ffdb99

Please sign in to comment.