elasticsearch/elasticsearch — Issue #1515: Bug Slf4j with log4j-over-slf4j in ESLoggerFactory => java.lang.NoSuchMethodError: org.apache.log4j.Logger.setLevel
Author: jmorille
Created: 2011-12-01 13:38:45+00:00
State: open

Hello,

With this combination of slf4j-api + logback + log4j-over-slf4j,
the ESLoggerFactory was select (as wrong) an Log4jESLoggerFactory.

As you known log4j-over-slf4j, is just a wrapper of log4j api in logback logger, to catch it.
That not good to log by log4j redirection, in this case.

In more, the result is an exception with method Log4jESLogger.setLevel(Log4jESLogger.java:48

Why did you open the isssue https://github.com/elasticsearch/elasticsearch/issues/1265 , that create this bug on August 20, 2011 ?

Could you revert the issue a83c45b ?

cf exception
14:17:26.781 [elasticsearch[Colonel America]clusterService#updateTask-pool-11-thread-1] WARN org.elasticsearch.indices.cluster - [Colonel America] [phonetic][0] failed to create shard
org.elasticsearch.index.shard.IndexShardCreationException: [phonetic][0] failed to create shard
at org.elasticsearch.index.service.InternalIndexService.createShard(InternalIndexService.java:300) [elasticsearch-0.18.5.jar:na]
at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyInitializingShard(IndicesClusterStateService.java:532) [elasticsearch-0.18.5.jar:na]
at org.elasticsearch.indices.cluster.IndicesClusterStateService.applyNewOrUpdatedShards(IndicesClusterStateService.java:501) [elasticsearch-0.18.5.jar:na]
at org.elasticsearch.indices.cluster.IndicesClusterStateService.clusterChanged(IndicesClusterStateService.java:173) [elasticsearch-0.18.5.jar:na]
at org.elasticsearch.cluster.service.InternalClusterService$2.run(InternalClusterService.java:271) [elasticsearch-0.18.5.jar:na]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_27]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_27]
at java.lang.Thread.run(Thread.java:662) [na:1.6.0_27]
Caused by: java.lang.NoSuchMethodError: org.apache.log4j.Logger.setLevel(Lorg/apache/log4j/Level;)V
at org.elasticsearch.common.logging.log4j.Log4jESLogger.setLevel(Log4jESLogger.java:48) [elasticsearch-0.18.5.jar:na]
at org.elasticsearch.index.search.slowlog.ShardSlowLogSearchService.(ShardSlowLogSearchService.java:144) [elasticsearch-0.18.5.jar:na]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [na:1.6.0_27]

Thank you

Jerome