slf4j-log4j jar required?

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.(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

Hi,

You don't need to slf4j-log4j bridge, but if slf4j jar (not the bridge,
the API) is in the classpath, it will be used by elasticsearch as the
logging framework. Do you have it in the classpath?

You don't need the yml configuration files.

-shay.banon

On Wed, Oct 20, 2010 at 1:59 AM, diptamay diptamay@gmail.com wrote:

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 SLF4J Error Codes
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
SLF4J Error Codes
[junit] at
org.elasticsearch.common.network.NetworkService.(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 SLF4J Error Codes
[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

Hi Shay

Thanks for the quick reply.

I see the problem now. Some project that my build is depending on, is
pulling in the slf4j api jar without adding a dependency for the slf4j
log4j bridge. Need to pull up that project owner for this.

If the logging.yml file is not included then where would the logging
output go? Would it go to console or Would it look at the log4j props
which I am including as part for my codebase?

Btw, I love the concept of the script fields and I just happened to
note it yesterday. It has already made my life a lot easier, apart
from the fact ES is really kick-ass. I have successfully stalled the
very discussion of Riak search as and when people brought it up. Not
sure where you have had a chance to look at Riak-ES integration (must
like the CouchDB river). Any plans?

Thanks
Diptamay

On Oct 19, 8:07 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Hi,

You don't need to slf4j-log4j bridge, but if slf4j jar (not the bridge,
the API) is in the classpath, it will be used by elasticsearch as the
logging framework. Do you have it in the classpath?

You don't need the yml configuration files.

-shay.banon

On Wed, Oct 20, 2010 at 1:59 AM, diptamay dipta...@gmail.com wrote:

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: Seehttp://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
SLF4J Error Codes
[junit] at
org.elasticsearch.common.network.NetworkService.(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
alsohttp://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(Slf 4jESLoggerFactory.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

On Wed, Oct 20, 2010 at 7:04 AM, diptamay diptamay@gmail.com wrote:

Hi Shay

Thanks for the quick reply.

I see the problem now. Some project that my build is depending on, is
pulling in the slf4j api jar without adding a dependency for the slf4j
log4j bridge. Need to pull up that project owner for this.

If the logging.yml file is not included then where would the logging
output go? Would it go to console or Would it look at the log4j props
which I am including as part for my codebase?

It will be based on the loggig you decide to you, and how you configure it.
It delegates when embedded.

Btw, I love the concept of the script fields and I just happened to
note it yesterday. It has already made my life a lot easier, apart
from the fact ES is really kick-ass. I have successfully stalled the
very discussion of Riak search as and when people brought it up. Not
sure where you have had a chance to look at Riak-ES integration (must
like the CouchDB river). Any plans?

First, I don't really think you need to stall testing Riak search, it can be
tested. There are big differences between the two, but the most important
one is that it does not come close in terms of feature set compared to
elasticsearch (I suspect, based on the architectural decision made by riak
search, that performance will also be very different, but that requires
verifying).

Riak-ES integration is possible. I am not familiar with Riak having a
_changes stream similar to elasticsearch, so the closest I can think is post
commit hooks, but thats on Riak side and not a River... .

Thanks
Diptamay

On Oct 19, 8:07 pm, Shay Banon shay.ba...@elasticsearch.com wrote:

Hi,

You don't need to slf4j-log4j bridge, but if slf4j jar (not the bridge,
the API) is in the classpath, it will be used by elasticsearch as the
logging framework. Do you have it in the classpath?

You don't need the yml configuration files.

-shay.banon

On Wed, Oct 20, 2010 at 1:59 AM, diptamay dipta...@gmail.com wrote:

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: Seehttp://
SLF4J Error Codes
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
SLF4J Error Codes
[junit] at

org.elasticsearch.common.network.NetworkService.(NetworkService.java:

[junit] while locating
org.elasticsearch.common.network.NetworkService
[junit] Caused by: java.lang.IllegalStateException:
org.slf4j.LoggerFactory could not be successfully initialized. See
alsohttp://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(Slf
4jESLoggerFactory.java:

[junit] at

org.elasticsearch.common.logging.ESLoggerFactory.getLogger(ESLoggerFactory.
java:

[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