From 17d2d873621d11adf86479bbc54808f7f2b73eda Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Wed, 31 Aug 2016 09:12:59 -0400 Subject: [PATCH 1/2] Increase visibility of deprecation logger The deprecation logger is an important way to make visible features of Elasticsearch that are deprecated. Yet, the default logging makes the log messages for the deprecation logger invisible. We want these log messages to be visible, so the default logging for the deprecation logger should enable these log messages. This commit changes the log level of deprecation log message to warn, and configures the deprecation logger so that these log messages are visible out of the box. --- .../org/elasticsearch/common/logging/DeprecationLogger.java | 4 ++-- .../java/org/elasticsearch/common/logging/ESLoggerTests.java | 2 +- distribution/src/main/resources/config/logging.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java b/core/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java index 5970f9173226d..afcef98fef712 100644 --- a/core/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java +++ b/core/src/main/java/org/elasticsearch/common/logging/DeprecationLogger.java @@ -131,9 +131,9 @@ void deprecated(Set threadContexts, String msg, Object... params) } } - logger.debug(formattedMsg); + logger.warn(formattedMsg); } else { - logger.debug(msg, params); + logger.warn(msg, params); } } diff --git a/core/src/test/java/org/elasticsearch/common/logging/ESLoggerTests.java b/core/src/test/java/org/elasticsearch/common/logging/ESLoggerTests.java index 67a6c0555c5cb..8826f456b63df 100644 --- a/core/src/test/java/org/elasticsearch/common/logging/ESLoggerTests.java +++ b/core/src/test/java/org/elasticsearch/common/logging/ESLoggerTests.java @@ -138,7 +138,7 @@ public void testDeprecationLogger() { List deprecationEvents = deprecationAppender.getEvents(); LoggingEvent event = deprecationEvents.get(0); assertThat(event, notNullValue()); - assertThat(event.getLevel(), equalTo(Level.DEBUG)); + assertThat(event.getLevel(), equalTo(Level.WARN)); assertThat(event.getRenderedMessage(), equalTo("This is a deprecation message")); } diff --git a/distribution/src/main/resources/config/logging.yml b/distribution/src/main/resources/config/logging.yml index 11cd181ebd0da..12cac3bd14e7f 100644 --- a/distribution/src/main/resources/config/logging.yml +++ b/distribution/src/main/resources/config/logging.yml @@ -6,8 +6,8 @@ logger: # log action execution errors for easier debugging action: DEBUG - # deprecation logging, turn to DEBUG to see them - deprecation: INFO, deprecation_log_file + # deprecation logging, turn to INFO to disable them + deprecation: WARN, deprecation_log_file # reduce the logging for aws, too much is logged under the default INFO com.amazonaws: WARN From c231d708cbfa6ca439c4df52492f67e5acf19002 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Wed, 31 Aug 2016 10:44:31 -0400 Subject: [PATCH 2/2] Update deprecation logging docs This commit updates the deprecation logging docs after the default logging level was changed to warn with all deprecation log messages emitted at the warn level. --- docs/reference/setup/configuration.asciidoc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/reference/setup/configuration.asciidoc b/docs/reference/setup/configuration.asciidoc index 68f73fc96b82d..88aaee8580d45 100644 --- a/docs/reference/setup/configuration.asciidoc +++ b/docs/reference/setup/configuration.asciidoc @@ -136,14 +136,17 @@ out of the box. In addition to regular logging, Elasticsearch allows you to enable logging of deprecated actions. For example this allows you to determine early, if you need to migrate certain functionality in the future. By default, -deprecation logging is disabled. You can enable it in the `config/logging.yml` -file by setting the deprecation log level to `DEBUG`. +deprecation logging is enabled at the WARN level, the level at which all +deprecation log messages will be emitted. [source,yaml] -------------------------------------------------- -deprecation: DEBUG, deprecation_log_file +deprecation: WARN, deprecation_log_file -------------------------------------------------- This will create a daily rolling deprecation log file in your log directory. Check this file regularly, especially when you intend to upgrade to a new major version. + +You can disable it in the `config/logging.yml` file by setting the deprecation +log level to `INFO`.