# In-memory ES not logging

**URL:** <https://discuss.elastic.co/t/in-memory-es-not-logging/14596>\
**Category:** Elasticsearch\
**Created:** [November 26, 2013, 11:40am UTC](https://discuss.elastic.co/t/in-memory-es-not-logging/14596 "2013-11-26T11:40:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicolas\_long](https://avatars.discourse-cdn.com/v4/letter/n/43a26b/32.png) [@nicolas\_long](https://discuss.elastic.co/u/nicolas_long)\
**Post date:** [November 26, 2013, 11:40am UTC](https://discuss.elastic.co/t/in-memory-es-not-logging/14596/1 "2013-11-26T11:40:14Z")

</div>

Hi all,

I've set up an in-memory ES which I use for testing purposes. But I can't  
seem to get logging working (everything else works fine). I've set the  
path.logs setting but do I need to do anything else? In particular do I  
need my own logging.yml? - I only want simple logging to debug tests so was  
hoping the defaults would be fine here...

My Scala code is below. Any thoughts appreciated.

object ElasticsearchLocalClient extends ElasticSearchClient {

lazy val client = node.client()

private[this] def node = {  
val settings = ImmutableSettings.settingsBuilder()  
.put("node.name", "my-local-node")  
.put("node.data", true)  
.put("cluster.name", "my-local-cluster")  
.put("index.store.type", "memory")  
.put("index.store.fs.memory.enabled", true)  
.put("gateway.type", "none")  
.put("path.data", "target/elasticsearch/data")  
_.put("path.logs", "target/elasticsearch/logs")_  
.put("index.number\_of\_shards", 1)  
.put("index.number\_of\_replicas", 0)  
.put("discovery.zen.ping.multicast.enabled", false)  
.put("node.local", true)

```
Try(nodeBuilder().settings(settings).local(true).node()) match {
  case Success(n) => n
  case Failure(_: OverlappingFileLockException) => sys.error("Unable to 

```

start Elasticsearch. Is it already running?")  
case Failure(e) =\> sys.error(s"Unable to start Elasticsearch:  
${e.getMessage}")  
}  
}

def start(index: String, mappings: Map[String, String]): Client = {  
waitForGreen()

```
if (!indexExists(index)) {
  createIndex(index, mappings) match {
    case Success(_) => client
    case Failure(e) => sys.error(s"Unable to add mappings to local 

```

Elasticsearch: ${e.getMessage}")  
}  
} else client  
}

def stop() {  
client.close()  
node.close()

```
FileSystemUtils.deleteRecursively(new File("./target/elasticsearch"), 

```

true)  
}

...

}

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 26, 2013, 1:00pm UTC](https://discuss.elastic.co/t/in-memory-es-not-logging/14596/2 "2013-11-26T13:00:40Z")

</div>

Hey,

you need to have a logging.yml in the classpath or configure it via  
path.conf setting. Not sure on the top of my head, but maybe calling  
LogConfigurator.configure(settings) could also help (this is called in the  
bootstrap class, which is not called, when the node runs embedded), would  
need to look it up to be really sure.

--Alex

On Tue, Nov 26, 2013 at 12:40 PM, [nicolas.long@guardian.co.uk](mailto:nicolas.long@guardian.co.uk) wrote:

> Hi all,
> 
> I've set up an in-memory ES which I use for testing purposes. But I can't  
> seem to get logging working (everything else works fine). I've set the  
> path.logs setting but do I need to do anything else? In particular do I  
> need my own logging.yml? - I only want simple logging to debug tests so was  
> hoping the defaults would be fine here...
> 
> My Scala code is below. Any thoughts appreciated.
> 
> object ElasticsearchLocalClient extends ElasticSearchClient {
> 
> lazy val client = node.client()
> 
> private[this] def node = {  
> val settings = ImmutableSettings.settingsBuilder()  
> .put("node.name", "my-local-node")  
> .put("node.data", true)  
> .put("cluster.name", "my-local-cluster")  
> .put("index.store.type", "memory")  
> .put("index.store.fs.memory.enabled", true)  
> .put("gateway.type", "none")  
> .put("path.data", "target/elasticsearch/data")  
> _.put("path.logs", "target/elasticsearch/logs")_  
> .put("index.number\_of\_shards", 1)  
> .put("index.number\_of\_replicas", 0)  
> .put("discovery.zen.ping.multicast.enabled", false)  
> .put("node.local", true)
> 
> ```
> Try(nodeBuilder().settings(settings).local(true).node()) match {
> case Success(n) => n
> case Failure(_: OverlappingFileLockException) => sys.error("Unable
> 
> ```
> 
> to start Elasticsearch. Is it already running?")  
> case Failure(e) =\> sys.error(s"Unable to start Elasticsearch:  
> ${e.getMessage}")  
> }  
> }
> 
> def start(index: String, mappings: Map[String, String]): Client = {  
> waitForGreen()
> 
> ```
> if (!indexExists(index)) {
> createIndex(index, mappings) match {
> case Success(_) => client
> case Failure(e) => sys.error(s"Unable to add mappings to local
> 
> ```
> 
> Elasticsearch: ${e.getMessage}")  
> }  
> } else client  
> }
> 
> def stop() {  
> client.close()  
> node.close()
> 
> ```
> FileSystemUtils.deleteRecursively(new File("./target/elasticsearch"),
> 
> ```
> 
> true)  
> }
> 
> ...
> 
> }
> 
> --  
> You received this message because you are subscribed to the Google Groups  
> "elasticsearch" group.  
> To unsubscribe from this group and stop receiving emails from it, send an  
> email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
> For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<div class="post-metadata">

**Author:** ![nicolas\_long](https://avatars.discourse-cdn.com/v4/letter/n/43a26b/32.png) [@nicolas\_long](https://discuss.elastic.co/u/nicolas_long)\
**Post date:** [November 26, 2013, 1:59pm UTC](https://discuss.elastic.co/t/in-memory-es-not-logging/14596/3 "2013-11-26T13:59:20Z")

</div>

Hey Alex, thanks. I didn't realise I had to provide some options here.  
Really useful to know.

Nic

On Tuesday, 26 November 2013 13:00:40 UTC, Alexander Reelsen wrote:

> Hey,
> 
> you need to have a logging.yml in the classpath or configure it via  
> path.conf setting. Not sure on the top of my head, but maybe calling  
> LogConfigurator.configure(settings) could also help (this is called in the  
> bootstrap class, which is not called, when the node runs embedded), would  
> need to look it up to be really sure.
> 
> --Alex
> 
> On Tue, Nov 26, 2013 at 12:40 PM, \<[nicola...@guardian.co.uk](mailto:nicola...@guardian.co.uk) \<javascript:\>\>wrote:
> 
> > Hi all,
> > 
> > I've set up an in-memory ES which I use for testing purposes. But I can't  
> > seem to get logging working (everything else works fine). I've set the  
> > path.logs setting but do I need to do anything else? In particular do I  
> > need my own logging.yml? - I only want simple logging to debug tests so was  
> > hoping the defaults would be fine here...
> > 
> > My Scala code is below. Any thoughts appreciated.
> > 
> > object ElasticsearchLocalClient extends ElasticSearchClient {
> > 
> > lazy val client = node.client()
> > 
> > private[this] def node = {  
> > val settings = ImmutableSettings.settingsBuilder()  
> > .put("node.name[http://www.google.com/url?q=http%3A%2F%2Fnode.name&sa=D&sntz=1&usg=AFQjCNE8Cff\_rbggu0\_UXL6VsgDVF5NFCg](http://www.google.com/url?q=http%3A%2F%2Fnode.name&sa=D&sntz=1&usg=AFQjCNE8Cff_rbggu0_UXL6VsgDVF5NFCg)",  
> > "my-local-node")  
> > .put("node.data", true)  
> > .put("cluster.name[http://www.google.com/url?q=http%3A%2F%2Fcluster.name&sa=D&sntz=1&usg=AFQjCNGbdss-\_rGgAY2He8KM6ZUy2TdG8g](http://www.google.com/url?q=http%3A%2F%2Fcluster.name&sa=D&sntz=1&usg=AFQjCNGbdss-_rGgAY2He8KM6ZUy2TdG8g)",  
> > "my-local-cluster")  
> > .put("index.store.type", "memory")  
> > .put("index.store.fs.memory.enabled", true)  
> > .put("gateway.type", "none")  
> > .put("path.data", "target/elasticsearch/data")  
> > _.put("path.logs", "target/elasticsearch/logs")_  
> > .put("index.number\_of\_shards", 1)  
> > .put("index.number\_of\_replicas", 0)  
> > .put("discovery.zen.ping.multicast.enabled", false)  
> > .put("node.local", true)
> > 
> > ```
> > Try(nodeBuilder().settings(settings).local(true).node()) match {
> > case Success(n) => n
> > case Failure(_: OverlappingFileLockException) => sys.error("Unable 
> > 
> > ```
> > 
> > to start Elasticsearch. Is it already running?")  
> > case Failure(e) =\> sys.error(s"Unable to start Elasticsearch:  
> > ${e.getMessage}")  
> > }  
> > }
> > 
> > def start(index: String, mappings: Map[String, String]): Client = {  
> > waitForGreen()
> > 
> > ```
> > if (!indexExists(index)) {
> > createIndex(index, mappings) match {
> > case Success(_) => client
> > case Failure(e) => sys.error(s"Unable to add mappings to local 
> > 
> > ```
> > 
> > Elasticsearch: ${e.getMessage}")  
> > }  
> > } else client  
> > }
> > 
> > def stop() {  
> > client.close()  
> > node.close()
> > 
> > ```
> > FileSystemUtils.deleteRecursively(new File("./target/elasticsearch"), 
> > 
> > ```
> > 
> > true)  
> > }
> > 
> > ...
> > 
> > }
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "elasticsearch" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [elasticsearc...@googlegroups.com](mailto:elasticsearc...@googlegroups.com) \<javascript:\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).

---

<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, 2:04am UTC](https://discuss.elastic.co/t/in-memory-es-not-logging/14596/4 "2017-07-06T02:04:48Z")

</div>


