henrybear327 commented on code in PR #10934:
URL: https://github.com/apache/ozone/pull/10934#discussion_r3769681163
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/local/OzoneLocal.java:
##########
@@ -197,13 +199,58 @@ static class RunCommand extends AbstractSubcommand
implements Callable<Void> {
public Void call() throws Exception {
LocalOzoneClusterConfig config = resolveConfig();
try (LocalOzoneRuntime runtime = createRuntime(config, getOzoneConf())) {
- runtime.start();
+ start(runtime);
printSummary(runtime, config);
awaitShutdown(runtime);
}
return null;
}
+ /**
+ * Starts {@code runtime}, restating a failure in a form the user can act
on. Service logs are
+ * off by default for this command, so the detail goes to the log for
{@code --loglevel INFO}
+ * while the message keeps {@link GenericCli}'s single-line path: an
exception with no message
+ * would otherwise print a raw stack trace.
+ */
+ private void start(LocalOzoneRuntime runtime) throws Exception {
+ try {
+ runtime.start();
+ } catch (Exception ex) {
+ LOG.error("Local Ozone cluster failed to start.", ex);
+ throw new IOException("Local Ozone failed to start: " +
failureMessage(ex)
+ + " Re-run with `ozone --loglevel INFO local run` for service
logs,"
+ + " or add --verbose for the full stack trace.", ex);
Review Comment:
I see your point. Since the user can use `--verbose` to show the error
anyways, let's remove it :)
#### With `failureMessage(ex)` removed
```text
Local Ozone failed to start. Re-run with `ozone --loglevel INFO local run`
for service logs, or add --verbose for the full stack trace.
```
Re-run with `--verbose`:
```text
java.io.IOException: Local Ozone failed to start. Re-run with `ozone
--loglevel INFO local run` ...
at
org.apache.hadoop.ozone.local.OzoneLocal$RunCommand.start(OzoneLocal.java:219)
at
org.apache.hadoop.ozone.local.OzoneLocal$RunCommand.call(OzoneLocal.java:201)
... 71 more frames ...
Caused by: java.io.IOException: ozone local requires ozone.replication=ONE,
but the configuration sets THREE (source: programmatically). Remove that value,
or run with a configuration directory (OZONE_CONF_DIR) that does not set it.
```
#### With `failureMessage(ex)`
```text
java.io.IOException: Local Ozone failed to start: ozone local requires
ozone.replication=ONE, but the configuration sets THREE (source:
programmatically). Remove that value, or run with a configuration directory
(OZONE_CONF_DIR) that does not set it. Re-run with `ozone --loglevel INFO local
run` for service logs, or add --verbose for the full stack trace.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]