Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not initialize a logger in Application #1975

Merged
merged 1 commit into from
Apr 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions core/runtime/src/main/java/io/quarkus/runtime/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,10 @@
*/
@SuppressWarnings("restriction")
public abstract class Application {
private static final Logger LOG = Logger.getLogger(Application.class);

// WARNING: do not inject a logger here, it's too early: the log manager has not been properly set up yet

private static final String DISABLE_SIGNAL_HANDLERS = "DISABLE_SIGNAL_HANDLERS";

private static final int ST_INITIAL = 0;
private static final int ST_STARTING = 1;
Expand Down Expand Up @@ -65,7 +68,7 @@ protected Application() {
* @implNote The command line args are not yet used, but at some point we'll want a facility for overriding config and/or
* letting the user hook into it.
*/
public final void start(@SuppressWarnings("unused") String[] args) {
public final void start(String[] args) {
final Lock stateLock = this.stateLock;
stateLock.lock();
try {
Expand Down Expand Up @@ -180,8 +183,7 @@ public final void stop() {
*/
public final void run(String[] args) {
try {
final String property = "DISABLE_SIGNAL_HANDLERS";
if (ImageInfo.inImageRuntimeCode() && System.getenv(property) == null) {
if (ImageInfo.inImageRuntimeCode() && System.getenv(DISABLE_SIGNAL_HANDLERS) == null) {
final SignalHandler handler = new SignalHandler() {
@Override
public void handle(final Signal signal) {
Expand All @@ -197,9 +199,8 @@ public void handle(final Signal signal) {
DiagnosticPrinter.printDiagnostics(System.out);
}
});
} else {
LOG.warn("Installation of signal handlers disabled by the presence of the environment variable: " + property);
}

final ShutdownHookThread shutdownHookThread = new ShutdownHookThread(Thread.currentThread());
Runtime.getRuntime().addShutdownHook(shutdownHookThread);
start(args);
Expand Down