laravel/nova-log-viewer
View and search your Laravel application logs directly inside Laravel Nova. Nova Log Viewer adds a simple tool UI with real-time polling support, making it easy to inspect errors, stack traces, and recent log entries without leaving the admin panel.
Installation
Run composer require laravel/nova-log-viewer in your Laravel project.
Ensure your project uses Laravel Nova (v3+ recommended).
Registration
Add the tool to Nova’s tools() method in app/Providers/NovaServiceProvider.php:
public function tools()
{
return [
\Laravel\Nova\LogViewer\LogViewer::make(),
];
}
First Use Case
error, info) or keyword (e.g., auth).Log Monitoring
error logs during deployment:
// In NovaServiceProvider::tools()
LogViewer::make()->withPollingInterval(5); // Refresh every 5 seconds
Debugging with Nova
error or debug logs.failed job).Integration with Nova Features
viaResource() method to attach the tool to a Nova resource (e.g., User):
LogViewer::make()->viaResource(User::class);
php artisan vendor:publish --tag=nova-log-viewer
Log Management
Log::clear() via Nova’s tool (if extended).LOG_MAX_FILES in .env to manage log file size.Polling Overhead
1s) may strain the server. Default (10s) is recommended.LOG_VIEWER_POLLING_INTERVAL in config/services.php or via the tool’s settings.Log File Permissions
storage/logs/ is writable:
chmod -R 775 storage/logs/
Large Log Files
laravel.log > 100MB) may cause timeouts.Log::clear() to rotate logs or increase LOG_MAX_FILES.Monolog-Specific Quirks
SingleFileHandler) may not display properly.storage/logs/laravel.log (default).Check Nova Logs
storage/logs/nova.log.Disable Polling for Testing
LogViewer::make()->withoutPolling();
Extend Log Levels
alert) by extending the tool’s view:
// Publish the tool first, then modify `resources/js/tools/LogViewer/Levels.vue`.
Custom Log Filters
public function boot()
{
\Laravel\Nova\LogViewer\LogViewer::extend(function ($tool) {
$tool->withCustomFilter(fn ($query) => $query->where('context.user_id', auth()->id()));
});
}
Add Log Actions
// resources/js/tools/LogViewer/LogEntry.vue
methods: {
replayJob(entry) {
Nova.request().post(`/nova-vendor/log-viewer/replay`, { entry });
}
}
Localization
php artisan vendor:publish --tag=nova-log-viewer-lang
resources/lang/vendor/nova-log-viewer/.How can I help you explore Laravel packages today?