[build] Log launch command before starting ES

This commit is contained in:
Nik Everett 2015-11-18 12:25:27 -05:00
parent 1f67ef2526
commit 19919a53a5
1 changed files with 12 additions and 4 deletions

View File

@ -258,6 +258,15 @@ class ClusterFormationTasks {
// this closure is the actual code to run elasticsearch
Closure elasticsearchRunner = {
// Command as string for logging
String esCommandString = "Elasticsearch command: ${executable} "
esCommandString += (esArgs + esProps).join(' ')
if (esEnv.isEmpty() == false) {
esCommandString += '\nenvironment:'
esEnv.each { k, v -> esCommandString += "\n ${k}: ${v}" }
}
logger.info(esCommandString)
ByteArrayOutputStream buffer = new ByteArrayOutputStream()
if (logger.isInfoEnabled() || config.daemonize == false) {
// run with piping streams directly out (even stderr to stdout since gradle would capture it)
@ -278,10 +287,9 @@ class ClusterFormationTasks {
} else {
logger.error("Couldn't start elasticsearch and couldn't find ${logFile}")
}
logger.error("Command: ${executable} ${(esArgs + esProps).join(' ')}")
if (esEnv.isEmpty() == false) {
logger.error('environment:')
esEnv.each { k, v -> logger.error(" ${k}: ${v}")}
if (logger.isInfoEnabled() == false) {
// We already log the command at info level. No need to do it twice.
logger.error(esCommandString)
}
throw new GradleException('Failed to start elasticsearch')
}