Skip to content

Commit 9f186bb

Browse files
committed
Since elastic#22200 the Settings class now uses a DeprecationLogger. It basically means that no settings should be used before Log4j's status logger has been configured without configuration by LogConfigurator.configureWithoutConfig() method.
1 parent 652cb7d commit 9f186bb

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

TESTING.asciidoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ You can also use Gradle to prepare the test environment and then starts a single
430430
gradle vagrantFedora24#up
431431
-------------------------------------------------
432432

433-
Or any of vagrantCentos6#up, vagrantDebian8#up, vagrantFedora24#up, vagrantOel6#up,
433+
Or any of vagrantCentos6#up, vagrantDebian8#up, vagrantCentos7#up, vagrantOel6#up,
434434
vagrantOel7#up, vagrantOpensuse13#up, vagrantSles12#up, vagrantUbuntu1204#up,
435435
vagrantUbuntu1604#up.
436436

core/src/main/java/org/elasticsearch/cli/Command.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ public final int main(String[] args, Terminal terminal) throws Exception {
8181

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

8786
try {
8887
mainWithoutErrorHandling(args, terminal);

core/src/main/java/org/elasticsearch/common/logging/LogConfigurator.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ public class LogConfigurator {
5858
* Configure logging without reading a log4j2.properties file, effectively configuring the
5959
* status logger and all loggers to the console.
6060
*
61-
* @param settings for configuring logger.level and individual loggers
61+
* @param loggerLevel for configuring logger.level
6262
*/
63-
public static void configureWithoutConfig(final Settings settings) {
64-
Objects.requireNonNull(settings);
63+
public static void configureWithoutConfig(final String loggerLevel) {
64+
Objects.requireNonNull(loggerLevel);
6565
// we initialize the status logger immediately otherwise Log4j will complain when we try to get the context
6666
configureStatusLogger();
67+
68+
Settings settings = Settings.builder().put("logger.level", loggerLevel).build();
6769
configureLoggerLevels(settings);
6870
}
6971

0 commit comments

Comments
 (0)