Skip to content

Commit

Permalink
Restore printing bootstrap checks as errors (#93178)
Browse files Browse the repository at this point in the history
Bootstrap check failures were unintentionally moved to the info level
in the log output. This commit restores logging them as errors.

closes #93074
  • Loading branch information
rjernst authored Jan 24, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent b79b846 commit 54fe770
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 6 additions & 0 deletions docs/changelog/93178.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pr: 93178
summary: Restore printing bootstrap checks as errors
area: Infra/CLI
type: bug
issues:
- 93074
12 changes: 6 additions & 6 deletions server/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java
Original file line number Diff line number Diff line change
@@ -11,14 +11,14 @@
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.lucene.util.SetOnce;
import org.elasticsearch.cli.ExitCodes;
import org.elasticsearch.common.settings.SecureSettings;
import org.elasticsearch.core.SuppressForbidden;
import org.elasticsearch.env.Environment;
import org.elasticsearch.node.NodeValidationException;

import java.io.PrintStream;

import static org.elasticsearch.bootstrap.BootstrapInfo.USER_EXCEPTION_MARKER;

/**
* A container for transient state during bootstrap of the Elasticsearch process.
*/
@@ -71,10 +71,10 @@ Environment environment() {
return nodeEnv.get();
}

void exitWithUserException(int exitCode, Exception e) {
err.print(USER_EXCEPTION_MARKER);
err.println(e.getMessage());
gracefullyExit(exitCode);
void exitWithNodeValidationException(NodeValidationException e) {
Logger logger = LogManager.getLogger(Elasticsearch.class);
logger.error("node validation exception\n{}", e.getMessage());
gracefullyExit(ExitCodes.CONFIG);
}

void exitWithUnknownException(Throwable e) {
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@
import org.apache.lucene.util.StringHelper;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.Version;
import org.elasticsearch.cli.ExitCodes;
import org.elasticsearch.common.ReferenceDocs;
import org.elasticsearch.common.filesystem.FileSystemNatives;
import org.elasticsearch.common.io.stream.InputStreamStreamInput;
@@ -68,7 +67,7 @@ public static void main(final String[] args) {
initPhase2(bootstrap);
initPhase3(bootstrap);
} catch (NodeValidationException e) {
bootstrap.exitWithUserException(ExitCodes.CONFIG, e);
bootstrap.exitWithNodeValidationException(e);
} catch (Throwable t) {
bootstrap.exitWithUnknownException(t);
}

0 comments on commit 54fe770

Please sign in to comment.