golovchanskiy/laravel-good-log-viewer
LaravelGoodLogViewer is a simple log reader, parser, and viewer for Laravel 5. Install via Composer, register the service provider and facade, publish config/translations, then browse logs at /logs. Includes English and Russian locales.
composer require golovchanskiy/laravel-good-log-viewer
config/app.php:
'providers' => [
// ...
\Golovchanskiy\LaravelGoodLogViewer\GoodLogViewerServiceProvider::class,
],
'aliases' => [
// ...
'GoodLogViewer' => \Golovchanskiy\LaravelGoodLogViewer\GoodLogViewer::class,
]
php artisan good-log-viewer:publish
/logs in your browser. No additional configuration is required for basic usage.Log Parsing & Display:
storage/logs/laravel.log) and renders them in a user-friendly format.$logs = GoodLogViewer::getLogs(100); // Fetch last 100 entries
Custom Log File Integration:
storage/logs/custom.log):
// In a service provider or config file:
'log_files' => [
storage_path('logs/laravel.log'),
storage_path('logs/custom.log'),
],
php artisan config:clear
Localization:
en) and Russian (ru) via the app config:
'locale' => 'ru', // or 'en'
API Access:
Route::get('/api/logs', function () {
return GoodLogViewer::getLogs(request('limit', 50));
});
/logs in production:
Route::middleware(['auth'])->group(function () {
Route::get('/logs', [LogViewerController::class, 'index']);
});
config/logging.php uses the default single channel for compatibility:
'default' => env('LOG_CHANNEL', 'single'),
queue), ensure the package’s file watcher is configured to poll frequently enough.File Permissions:
www-data, nginx) has read access to storage/logs/.chmod -R 755 storage/logs/
chown -R www-data:www-data storage/logs/
Log Rotation:
laravel-log-rotate), the package may not auto-detect new files. Manually add paths to config/good-log-viewer.php:
'log_files' => [
storage_path('logs/laravel-*.log'),
],
Caching:
php artisan cache:clear
Laravel Version:
spatie/laravel-log-viewer.Logs Not Showing:
storage/logs/laravel.log.'rotation' => [
'enabled' => false,
],
Facade Not Found:
config/app.php and the service provider is loaded.Custom Log Formatters:
LogEntry model to modify how logs are parsed:
namespace App\Models;
use Golovchanskiy\LaravelGoodLogViewer\Models\LogEntry as BaseLogEntry;
class LogEntry extends BaseLogEntry {
public function getMessageAttribute($value) {
return "[Custom] " . parent::getMessageAttribute($value);
}
}
$this->app->bind(
\Golovchanskiy\LaravelGoodLogViewer\Models\LogEntry::class,
App\Models\LogEntry::class
);
Add Filters:
LogFilter class to add custom search functionality:
namespace App\Filters;
use Golovchanskiy\LaravelGoodLogViewer\Filters\LogFilter as BaseLogFilter;
class LogFilter extends BaseLogFilter {
public function byLevel($level) {
return $this->where('level', $level);
}
}
'filter_class' => App\Filters\LogFilter::class,
Theming:
resources/views/vendor/good-log-viewer to customize the UI.if (app()->environment('local')) {
Route::get('/logs', [GoodLogViewerController::class, 'index']);
}
search parameter in the /logs route to filter logs:
/logs?search=error
'default_limit' => 1000, // in config/good-log-viewer.php
How can I help you explore Laravel packages today?