Skip to content

Commit

Permalink
Since elastic#22200 the Settings class now uses a DeprecationLogger. …
Browse files Browse the repository at this point in the history
…It basically means that no settings should be used before Log4j's status logger has been configured without configuration by LogConfigurator.configureWithoutConfig() method.
  • Loading branch information
tlrx committed Jan 19, 2017
1 parent 652cb7d commit 9f186bb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion TESTING.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ You can also use Gradle to prepare the test environment and then starts a single
gradle vagrantFedora24#up
-------------------------------------------------

Or any of vagrantCentos6#up, vagrantDebian8#up, vagrantFedora24#up, vagrantOel6#up,
Or any of vagrantCentos6#up, vagrantDebian8#up, vagrantCentos7#up, vagrantOel6#up,
vagrantOel7#up, vagrantOpensuse13#up, vagrantSles12#up, vagrantUbuntu1204#up,
vagrantUbuntu1604#up.

Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/org/elasticsearch/cli/Command.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ public final int main(String[] args, Terminal terminal) throws Exception {

// initialize default for es.logger.level because we will not read the log4j2.properties
final String loggerLevel = System.getProperty("es.logger.level", Level.INFO.name());
final Settings settings = Settings.builder().put("logger.level", loggerLevel).build();
LogConfigurator.configureWithoutConfig(settings);
LogConfigurator.configureWithoutConfig(loggerLevel);

try {
mainWithoutErrorHandling(args, terminal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,14 @@ public class LogConfigurator {
* Configure logging without reading a log4j2.properties file, effectively configuring the
* status logger and all loggers to the console.
*
* @param settings for configuring logger.level and individual loggers
* @param loggerLevel for configuring logger.level
*/
public static void configureWithoutConfig(final Settings settings) {
Objects.requireNonNull(settings);
public static void configureWithoutConfig(final String loggerLevel) {
Objects.requireNonNull(loggerLevel);
// we initialize the status logger immediately otherwise Log4j will complain when we try to get the context
configureStatusLogger();

Settings settings = Settings.builder().put("logger.level", loggerLevel).build();
configureLoggerLevels(settings);
}

Expand Down

0 comments on commit 9f186bb

Please sign in to comment.