Skip to content

Commit

Permalink
Merge pull request #1662 from evnm/dropwizard-core/configure-bootstra…
Browse files Browse the repository at this point in the history
…pped-log-level

Overridable log level during application bootstrap process
  • Loading branch information
arteam committed Aug 3, 2016
2 parents 2a923a6 + 99a7e1b commit e3d6c37
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions dropwizard-core/src/main/java/io/dropwizard/Application.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.dropwizard;

import ch.qos.logback.classic.Level;
import io.dropwizard.cli.CheckCommand;
import io.dropwizard.cli.Cli;
import io.dropwizard.cli.ServerCommand;
Expand All @@ -12,16 +13,25 @@
/**
* The base class for Dropwizard applications.
*
* The default constructor will be inherited in subclasses if
* a default constructor isn't provided. If you do provide one,
* it's important to call default constructor to preserve logging
* Because the default constructor will be inherited by all
* subclasses, {BootstrapLogging.bootstrap()} will always be
* invoked. The log level used during the bootstrap process can be
* configured by {Application} subclasses by overriding
* {#bootstrapLogLevel}.
*
* @param <T> the type of configuration class for this application
*/
public abstract class Application<T extends Configuration> {
protected Application() {
// make sure spinning up Hibernate Validator doesn't yell at us
BootstrapLogging.bootstrap();
BootstrapLogging.bootstrap(bootstrapLogLevel());
}

/**
* The log level at which to bootstrap logging on application startup.
*/
protected Level bootstrapLogLevel() {
return Level.WARN;
}

/**
Expand Down

0 comments on commit e3d6c37

Please sign in to comment.