Skip to content

Commit e03cbb2

Browse files
committed
[TEST] print elasticsearch.log if cluster fails to start
1 parent c5db567 commit e03cbb2

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
@@ -24,7 +24,22 @@
2424
$count += 1;
2525

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

0 commit comments

Comments
 (0)