# Not able to configure log4j2 correctly for Elasticsearch 5.0

**URL:** https://discuss.elastic.co/t/not-able-to-configure-log4j2-correctly-for-elasticsearch-5-0/66943
**Category:** Elasticsearch
**Created:** [November 23, 2016, 5:28am UTC](https://discuss.elastic.co/t/not-able-to-configure-log4j2-correctly-for-elasticsearch-5-0/66943 "2016-11-23T05:28:16Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![anishm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/anishm/32/28796_2.png) [@anishm](https://discuss.elastic.co/u/anishm)
#### Post date: [November 23, 2016, 5:28am UTC](https://discuss.elastic.co/t/not-able-to-configure-log4j2-correctly-for-elasticsearch-5-0/66943/1 "2016-11-23T05:28:16Z")

</div>

The goal is to have elasticsearch logs in json format so that logstash is able to pick it up and index it in another elasticsearch cluster dedicated to logging.

1. First the file jsonevent-layout-1.7.jar was copied to the /elasticsearch-home/lib directory

2. The log4j2.properties file was configured as follows:

However, when I run bin/elasticsearch, I get these messages

> 2016-11-23 10:37:44,768 main ERROR Unable to locate plugin type for net.logstash.log4j.JSONEventLayoutV1  
> 2016-11-23 10:37:44,770 main ERROR Unable to locate plugin type for net.logstash.log4j.JSONEventLayoutV1  
> 2016-11-23 10:37:44,770 main ERROR Unable to locate plugin type for net.logstash.log4j.JSONEventLayoutV1  
> 2016-11-23 10:37:44,770 main ERROR Unable to locate plugin type for net.logstash.log4j.JSONEventLayoutV1  
> 2016-11-23 10:37:44,771 main ERROR Unable to locate plugin type for net.logstash.log4j.JSONEventLayoutV1  
> 2016-11-23 10:37:44,791 main ERROR Unable to locate plugin for net.logstash.log4j.JSONEventLayoutV1  
> 2016-11-23 10:37:44,794 main ERROR Unable to invoke factory method in class class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile. java.lang.NullPointerException  
> at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.findNamedNode(PluginElementVisitor.java:100)  
> at org.apache.logging.log4j.core.config.plugins.visitors.PluginElementVisitor.visit(PluginElementVisitor.java:87)  
> at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.generateParameters(PluginBuilder.java:243)  
> at org.apache.logging.log4j.core.config.plugins.util.PluginBuilder.build(PluginBuilder.java:131)  
> at org.apache.logging.log4j.core.config.AbstractConfiguration.createPluginObject(AbstractConfiguration.java:918)  
> at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:858)  
> at org.apache.logging.log4j.core.config.AbstractConfiguration.createConfiguration(AbstractConfiguration.java:850)  
> at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:479)  
> at org.apache.logging.log4j.core.config.AbstractConfiguration.initialize(AbstractConfiguration.java:219)  
> at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:231)  
> at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:496)  
> at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:249)  
> at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:116)  
> at org.elasticsearch.common.logging.LogConfigurator.configure(LogConfigurator.java:83)  
> at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:249)  
> at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:112)  
> at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:103)  
> at org.elasticsearch.cli.SettingCommand.execute(SettingCommand.java:54)  
> at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:96)  
> at org.elasticsearch.cli.Command.main(Command.java:62)  
> at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:80)  
> at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:73)

Looks like when starting, elasticsearch is not able to read the jsonevent-layout-1.7.jar file in the lib folder. Do i have to make any more changes? Where could I be going wrong?

---

<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: [December 21, 2016, 5:28am UTC](https://discuss.elastic.co/t/not-able-to-configure-log4j2-correctly-for-elasticsearch-5-0/66943/2 "2016-12-21T05:28:24Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
