Skip to content

Commit caf0c08

Browse files
committed
[TEST] print elasticsearch.log if cluster fails to start
1 parent 553b433 commit caf0c08

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

util/EnsureClusterAlive.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,22 @@
2626
$count += 1;
2727

2828
if ($count > 15) {
29-
throw new \Exception("Live cluster could not be found in 15s!");
29+
echo "Live cluster could not be found in 15s!\nContents of elasticsearch.log:\n\n";
30+
31+
$dir = new DirectoryIterator(dirname(__DIR__));
32+
33+
foreach ($dir as $fileinfo) {
34+
if ($fileinfo->isDir() && !$fileinfo->isDot()) {
35+
if (strpos($fileinfo->getFilename(), "elasticsearch") === 0) {
36+
$log = file_get_contents(dirname(__DIR__)."/$fileinfo/logs/elasticsearch.log");
37+
echo $log;
38+
break;
39+
}
40+
41+
}
42+
}
43+
44+
throw new \Exception();
3045
}
3146
sleep(1);
3247
}

0 commit comments

Comments
 (0)