# Elasticsearch v6.2 ERROR No log4j2 configuration file found

**URL:** <https://discuss.elastic.co/t/elasticsearch-v6-2-error-no-log4j2-configuration-file-found/132310>\
**Category:** Elasticsearch\
**Created:** [May 17, 2018, 10:38am UTC](https://discuss.elastic.co/t/elasticsearch-v6-2-error-no-log4j2-configuration-file-found/132310 "2018-05-17T10:38:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Devapp](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@Devapp](https://discuss.elastic.co/u/Devapp)\
**Post date:** [May 17, 2018, 10:38am UTC](https://discuss.elastic.co/t/elasticsearch-v6-2-error-no-log4j2-configuration-file-found/132310/1 "2018-05-17T10:38:03Z")

</div>

I'm following the [instructions](https://www.elastic.co/blog/running-elasticsearch-on-aws) in order to install elasticsearch on an amazon ec2 instance. I have installed this elasticsearch [version](https://www.elastic.co/guide/en/elasticsearch/reference/current/rpm.html) and also two [plugins](https://www.elastic.co/guide/en/elasticsearch/plugins/current/cloud-aws.html). Also I have updated the java version to [this.](https://blog.knoldus.com/2017/02/08/installing-latest-oracle-jdk-on-linux-ec2-instance-centos/)

And when I try to start elasticsearch with sudo service elasticsearch start I get the following error:

```
[ec2-user@ip-xxx-xx-x-xxx src]$ sudo service elasticsearch start
Starting elasticsearch: Exception in thread "main" 2018-05-17 
07:52:11,411 main ERROR No log4j2 configuration file found. Using
default configuration: logging only errors to the console. Set system
property 'log4j2.debug' to show Log4j2 internal initialization 
logging.
ElasticsearchParseException[malformed, expected end of settings but
encountered additional content starting at line number: [33], column 
number: [1]]; nested: MarkedYAMLException[expected '<document 
start>', but found BlockMappingStart
in 'reader', line 33, column 1:
path.data: /var/lib/elasticsearch
^

at [Source: sun.nio.ch.ChannelInputStream@1fa121e2; line: 33, column: 
1]]; nested: ParserException[expected '<document start>', but found 
BlockMappingStart
in 'reader', line 33, column 1:
path.data: /var/lib/elasticsearch
^
];
at 
org.elasticsearch.common.settings.Settings.fromXContent
(Settings.java:683)
at org.elasticsearch.common.settings.Settings.access$500
(Settings.java:82)
at org.elasticsearch.common.settings.Settings$Builder.loadFromStream
(Settings.java:1183)
at org.elasticsearch.common.settings.Settings$Builder.loadFromPath
(Settings.java:1162)
at org.elasticsearch.node.InternalSettingsPreparer.prepareEnvironment
(InternalSettingsPreparer.java:99)
at org.elasticsearch.cli.EnvironmentAwareCommand.createEnv
(EnvironmentAwareCommand.java:95)
at org.elasticsearch.cli.EnvironmentAwareCommand.execute
(EnvironmentAwareCommand.java:86)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling
(Command.java:124)
at org.elasticsearch.cli.Command.main(Command.java:90)
at org.elasticsearch.bootstrap.Elasticsearch.main
(Elasticsearch.java:92)
at org.elasticsearch.bootstrap.Elasticsearch.main
(Elasticsearch.java:85)
Caused by:  
com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.
MarkedYAMLException: expected '<document start>', but found   

BlockMappingStart
in 'reader', line 33, column 1:
path.data: /var/lib/elasticsearch
^

at [Source: sun.nio.ch.ChannelInputStream@1fa121e2; line: 33, column: 1]
at com.fasterxml.jackson.dataformat.yaml.snakeyaml.error.
MarkedYAMLException.from(MarkedYAMLException.java:27)
at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken
(YAMLParser.java:343)
at  
org.elasticsearch.common.xcontent.json.JsonXContentParser.nextToken
(JsonXContentParser.java:52)
at org.elasticsearch.common.settings.Settings.fromXContent
(Settings.java:678)
... 10 more
Caused by: expected '<document start>', but found BlockMappingStart
in 'reader', line 33, column 1:
path.data: /var/lib/elasticsearch
^

at org.yaml.snakeyaml.parser.ParserImpl$ParseDocumentStart.produce
(ParserImpl.java:224)
at org.yaml.snakeyaml.parser.ParserImpl.peekEvent
(ParserImpl.java:157)
at org.yaml.snakeyaml.parser.ParserImpl.getEvent(ParserImpl.java:167)
at com.fasterxml.jackson.dataformat.yaml.YAMLParser.nextToken
(YAMLParser.java:340)
... 12 more

```

How can I solve this issue?

---

<div class="post-metadata">

**Author:** ![Devapp](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@Devapp](https://discuss.elastic.co/u/Devapp)\
**Post date:** [May 17, 2018, 11:16am UTC](https://discuss.elastic.co/t/elasticsearch-v6-2-error-no-log4j2-configuration-file-found/132310/2 "2018-05-17T11:16:07Z")

</div>

I tried the following but still got the same error. I added the log4j2.xml and log4j2.properties files to the src/main/resources path.

log4j2.xml

```
<dependency>
  <groupId>org.apache.logging.log4j</groupId>
  <artifactId>log4j-core</artifactId>
  <version>2.9.1</version>
</dependency>

```

log4j2.properties

```
appender.console.type = Console
appender.console.name = console
appender.console.layout.type = PatternLayout

rootLogger.level = info
rootLogger.appenderRef.console.ref = console
```

---

<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:** [June 14, 2018, 11:16am UTC](https://discuss.elastic.co/t/elasticsearch-v6-2-error-no-log4j2-configuration-file-found/132310/3 "2018-06-14T11:16:22Z")

</div>

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