use System.err and System.out to print exit messages on CliPeon (#6975)

* use System.err and System.out to print exit messages on CliPeon

* more

* not necessarily a stopping error...
This commit is contained in:
Clint Wylie 2019-02-01 02:54:14 -08:00 committed by Benedict Jin
parent f7df5fedcc
commit 5c0fbbda1b
1 changed files with 6 additions and 3 deletions

View File

@ -35,6 +35,7 @@ import com.google.inject.name.Names;
import io.airlift.airline.Arguments;
import io.airlift.airline.Command;
import io.airlift.airline.Option;
import io.netty.util.SuppressForbidden;
import org.apache.druid.client.cache.CacheConfig;
import org.apache.druid.client.coordinator.CoordinatorClient;
import org.apache.druid.client.indexing.HttpIndexingServiceClient;
@ -345,6 +346,7 @@ public class CliPeon extends GuiceRunnable
);
}
@SuppressForbidden(reason = "System#out, System#err")
@Override
public void run()
{
@ -375,14 +377,15 @@ public class CliPeon extends GuiceRunnable
Runtime.getRuntime().removeShutdownHook(hook);
}
catch (IllegalStateException e) {
log.warn("Cannot remove shutdown hook, already shutting down");
System.err.println("Cannot remove shutdown hook, already shutting down!");
}
}
catch (Throwable t) {
log.error(t, "Error when starting up. Failing.");
System.err.println("Error!");
System.err.println(Throwables.getStackTraceAsString(t));
System.exit(1);
}
log.info("Finished peon task");
System.out.println("Finished peon task");
}
catch (Exception e) {
throw Throwables.propagate(e);