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

Fix status logger message at startup #22687

Closed
wants to merge 1 commit into from

Conversation

tlrx
Copy link
Member

@tlrx tlrx commented Jan 19, 2017

Since #22200 the Settings class now uses a static DeprecationLogger. This makes Log4j2 status logger yells when Elasticsearch starts with the message ERROR StatusLogger No log4j2 configuration file found. Using default configuration because this deprecation logger is instantiated before the status logger has been configured.

This commit changes the LogConfigurator.configureWithoutConfig() method so that the status logger is initialized without using any Settings, making the message disappear.

…It basically means that no settings should be used before Log4j's status logger has been configured without configuration by LogConfigurator.configureWithoutConfig() method.
Copy link
Member

@danielmitterdorfer danielmitterdorfer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@jasontedor jasontedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unfortunate, and the situation feels very fragile to me now. I looked at the call-sites for Settings#getAsBooleanLenientForPreEs6Indices and it looks like in all places we have a deprecation logger that we can push down into this method and just use that logger rather than a static logger on the Settings class. This means that the logging message would also contain the class name where the setting is coming from, rather than a generic o.e.d.c.s.Settings as the logger name. I think that is more helpful for this situation than just saying "only_longest_match" is deprecated as it doesn't tell you where it's coming from. What do you think @tlrx?

@@ -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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this inadvertent?

*/
public static void configureWithoutConfig(final Settings settings) {
Objects.requireNonNull(settings);
public static void configureWithoutConfig(final String loggerLevel) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This situation feels very fragile to me. It means in the future if we do want a settings instance here because we want to control fine-grained logging settings for a CLI tool, we can not without accidentally reintroducing the problem.

@tlrx
Copy link
Member Author

tlrx commented Jan 19, 2017

@jasontedor I fully agree with your concerns. I was happy enough to have found the cause of this regression but this PR is not the long term solution we must have. So I'm +1 on closing this and maybe @danielmitterdorfer who worked on #22200 can implement your suggestion?

@jasontedor
Copy link
Member

So I'm +1 on closing this and maybe @danielmitterdorfer who worked on #22200 can implement your suggestion?

@danielmitterdorfer Will you fix this along the lines I described?

@jasontedor
Copy link
Member

I discussed this with @danielmitterdorfer via another channel and have opened #22696 as a result of that conversation.

@jasontedor
Copy link
Member

Thanks for tracking down the cause of the issue @tlrx.

@jasontedor
Copy link
Member

Superseded by #22696

@jasontedor jasontedor closed this Jan 19, 2017
@tlrx tlrx deleted the use-settings-after-logger branch January 19, 2017 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Logging Log management and logging utilities
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants