Skip to content

Commit

Permalink
[TEST] print elasticsearch.log if cluster fails to start
Browse files Browse the repository at this point in the history
  • Loading branch information
polyfractal committed Sep 14, 2017
1 parent fd75e99 commit fe796aa
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion util/EnsureClusterAlive.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,22 @@
$count += 1;

if ($count > 15) {
throw new \Exception("Live cluster could not be found in 15s!");
echo "Live cluster could not be found in 15s!\nContents of elasticsearch.log:\n\n";

$dir = new DirectoryIterator(dirname(__DIR__));

foreach ($dir as $fileinfo) {
if ($fileinfo->isDir() && !$fileinfo->isDot()) {
if (strpos($fileinfo->getFilename(), "elasticsearch") === 0) {
$log = file_get_contents(dirname(__DIR__)."/$fileinfo/logs/elasticsearch.log");
echo $log;
break;
}

}
}

throw new \Exception();
}
sleep(1);
}
Expand Down

0 comments on commit fe796aa

Please sign in to comment.