mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 03:07:30 -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; | namespace App\Utils; | ||||||
| 
 | 
 | ||||||
|  | use LimitIterator; | ||||||
|  | use SplFileObject; | ||||||
| use App\Libraries\MultiDB; | use App\Libraries\MultiDB; | ||||||
| use App\Mail\TestMailServer; | use App\Mail\TestMailServer; | ||||||
| use Exception; | use Exception; | ||||||
| @ -337,11 +339,12 @@ class SystemHealth | |||||||
| 
 | 
 | ||||||
|     public static function lastError() |     public static function lastError() | ||||||
|     { |     { | ||||||
|         $filepath = storage_path('logs/laravel.log'); |         $log_file = new SplFileObject(sprintf('%s/laravel.log', base_path('storage/logs'))); | ||||||
|         $file = escapeshellarg($filepath); |         $log_file->seek(PHP_INT_MAX); | ||||||
|         $end_of_file = `tail -n 500 $file`; |         $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 = ''; |         $last_error = ''; | ||||||
| 
 | 
 | ||||||
|         foreach ($lines as $line) { |         foreach ($lines as $line) { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user