mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Update code used to retrieve last error in the logs
This commit is contained in:
parent
c91be53b6d
commit
11bfb99b0a
@ -11,6 +11,8 @@
|
||||
|
||||
namespace App\Utils;
|
||||
|
||||
use LimitIterator;
|
||||
use SplFileObject;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Mail\TestMailServer;
|
||||
use Exception;
|
||||
@ -337,11 +339,12 @@ class SystemHealth
|
||||
|
||||
public static function lastError()
|
||||
{
|
||||
$filepath = storage_path('logs/laravel.log');
|
||||
$file = escapeshellarg($filepath);
|
||||
$end_of_file = `tail -n 500 $file`;
|
||||
$log_file = new SplFileObject(sprintf('%s/laravel.log', base_path('storage/logs')));
|
||||
$log_file->seek(PHP_INT_MAX);
|
||||
$last_line = $log_file->key();
|
||||
|
||||
$lines = explode("\n", $end_of_file);
|
||||
$lines = new LimitIterator($log_file, max(0, $last_line - 500), $last_line);
|
||||
$log_lines = iterator_to_array($lines);
|
||||
$last_error = '';
|
||||
|
||||
foreach ($lines as $line) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user