In-memory ES not logging

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.
For more options, visit https://groups.google.com/groups/opt_out.

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 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.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.

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 <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.namehttp://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.namehttp://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 <javascript:>.
For more options, visit 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.
For more options, visit https://groups.google.com/groups/opt_out.