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

Logger warning using Elasticsearch Java API #10421

Closed
Ghost93 opened this issue Apr 3, 2015 · 9 comments
Closed

Logger warning using Elasticsearch Java API #10421

Ghost93 opened this issue Apr 3, 2015 · 9 comments
Labels
:Core/Infra/Logging Log management and logging utilities discuss

Comments

@Ghost93
Copy link

Ghost93 commented Apr 3, 2015

Hi,

We have a java application that indexes documents to an elasticsearch setup.
The application uses log4j2 as its' logging library.

At startup, when Client is initialized, the following warning messages occur:

log4j:WARN No appenders could be found for logger (org.elasticsearch.plugins).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

The easy solution would be to hold log4j.properties file but I try to avoid this, since I already use log4j2.properties I would prefer to "bridge" over elastic's log4j logs to my log4j2.

I tried creating a logger at my log4j2 configuration named org.elasticseach.plugins but it didn't help.

Googling this problem found this stackoverflow question that was posted a year ago and was not answered.
I email the guy asked the question and he said in the end they didn't solve it, just left it.

Anyone got an idea?

Thanks.

@snowwolf007cn
Copy link

Oops, I have the same problem

@jmcomets
Copy link

+1, same problem here. This is really cluttering my logs/nerves.

@rubenve
Copy link

rubenve commented Sep 18, 2015

+1 I'm the Stackoverflow guy. :)

@clintongormley clintongormley added the :Core/Infra/Logging Log management and logging utilities label Sep 19, 2015
@Ghost93
Copy link
Author

Ghost93 commented Dec 5, 2015

@clintongormley
any news on this issue?

@oubenali
Copy link

Has anyone found a solution ? I received the same warnings

@jmoney
Copy link

jmoney commented Jan 24, 2016

Do you use the slf4j-apis with the log4j2 bindings or do you use the log4j2 apis directly?

The "future proof" way of doing this is use the slf4j-apis with an slf4j implementation of the apis(in this case log4j2). Then, you can use the log4j12-over-slf4j library that routes all log4j to slf4j which should then proxy to log4j2 in your case.

That "should" work. It's how I migrated everything to logback a year ago in some of my projects and I encountered similar errors. I assume the same process would work for log4j2(just have not tried it yet) as this problem is exactly why slf4j came into existence in the first place.

@Ghost93
Copy link
Author

Ghost93 commented Jan 24, 2016

@jmoney8080 could you please provide a detailed sample?
Thanks!

@jmoney
Copy link

jmoney commented Jan 24, 2016

https://github.com/jmoney8080/slf4j-example

you can download that repo and run mvn clean -U package and it should compile and show the logging. There is a README explaining the setup.

Basically,

  1. log4j is ONLY a log4j project
  2. log4j2 is ONLY a log4j project
  3. slf4j-log4j2 depends on (1) and (2) but uses slf4j with log4j implementation. It then delegates all log4j classes to slf4j so that logging from all three classes continues to work.

@jasontedor
Copy link
Member

Closing in favor of #17697.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Logging Log management and logging utilities discuss
Projects
None yet
Development

No branches or pull requests

8 participants