# slf4j-log4j jar required?

**URL:** <https://discuss.elastic.co/t/slf4j-log4j-jar-required/3458>\
**Category:** Elasticsearch\
**Created:** [October 19, 2010, 11:37pm UTC](https://discuss.elastic.co/t/slf4j-log4j-jar-required/3458 "2010-10-19T23:37:18Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diptamay](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/diptamay/32/2805_2.png) [@Diptamay](https://discuss.elastic.co/u/Diptamay)\
**Post date:** [October 19, 2010, 11:37pm UTC](https://discuss.elastic.co/t/slf4j-log4j-jar-required/3458/1 "2010-10-19T23:37:18Z")

</div>

Hi

This is probably a silly question. But so far I have always used ES's http endpoint to do my searching. Now that I am trying to use the java api, I dropped in the elasticsearch-0.12.0.jar into my classpath and expected my tests to run which is just creating a TransportClient at the moment.

However, slf4j starts giving errors using Guice injection. Start of the error stack trace bloew is

[BF-INFO] Source Directory: '/Users/sanyal/Documents/workspace/mlbam/svn/cms/search/client/test/java'  
[BF-INFO] Include: '**/\*'  
[BF-INFO] Exclude: ' **/CVS/**'  
[BF-INFO] Exclude: '**/.svn/\*\*'  
[javac] Compiling 1 source file to /Users/sanyal/Documents/workspace/mlbam/svn/cms/search/client/build/test/java/classes  
[junit] Running com.bamnetworks.cms.search.test.ESClientTest  
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 4.167 sec  
[junit] Testsuite: com.bamnetworks.cms.search.test.ESClientTest  
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 4.167 sec

```
[junit] ------------- Standard Error -----------------
[junit] SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
[junit] SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[junit] ------------- ---------------- ---------------
[junit] Testcase: testGetESEndpoints(com.bamnetworks.cms.search.test.ESClientTest):	Caused an ERROR
[junit] Guice creation errors:

[junit] 1) Error injecting constructor, java.lang.IllegalStateException: org.slf4j.LoggerFactory could not be successfully initialized. See also http://www.slf4j.org/codes.html#unsuccessfulInit
[junit] at org.elasticsearch.common.network.NetworkService.<init>(NetworkService.java:63)
[junit] while locating org.elasticsearch.common.network.NetworkService
[junit] Caused by: java.lang.IllegalStateException: org.slf4j.LoggerFactory could not be successfully initialized. See also http://www.slf4j.org/codes.html#unsuccessfulInit
[junit] at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:282)
[junit] at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248)
[junit] at org.elasticsearch.common.logging.slf4j.Slf4jESLoggerFactory.newInstance(Slf4jESLoggerFactory.java:32)
[junit] at org.elasticsearch.common.logging.ESLoggerFactory.getLogger(ESLoggerFactory.java:60)
[junit] at org.elasticsearch.common.logging.Loggers.getLogger(Loggers.java:142)
[junit] at org.elasticsearch.common.logging.Loggers.getLogger(Loggers.java:105)

```

After dropping in the slf4j-log4j jar, which I downloaded separately, this starts working. I don't see any dependency of this in the ES maven poms or even in the ES distribution download itself.

Any idea what could be the issue here?

As a side note, do I need logging.yml and elasticsearch.yml in my classpath for the ES client to work properly.

Thanks  
Diptamay

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:17am UTC](https://discuss.elastic.co/t/slf4j-log4j-jar-required/3458/2 "2017-07-06T04:17:48Z")

</div>


