- How do I install Laravel Log Viewer in a Laravel 11 project?
- Run `composer require dipeshshihora/laravel-log-viewer`, then add the route in `routes/web.php` using `LogViewerController@index`. If not using auto-discovery, register the service provider in `config/app.php`. No additional assets are needed.
- Does this package work with Lumen?
- Yes, it supports Lumen 9–12. Register the service provider in `bootstrap/app.php` and add the route using the fully qualified controller path. The same config and view customization options apply.
- Can I customize the log viewer’s UI or pagination?
- Absolutely. Publish the Blade view with `php artisan vendor:publish --tag=views` and edit the template in `resources/views/vendor/laravel-log-viewer/`. Adjust pagination by modifying `lines_per_page` in the published config file.
- What Laravel versions are supported?
- The package works with Laravel 9 through 12 and Lumen 9–12. It requires PHP 8.1+. Check the GitHub repo for updates, as newer Laravel versions may need minor adjustments.
- How do I secure the log viewer route in production?
- Wrap the route in Laravel’s middleware (e.g., `auth`, `can:view-logs`) to restrict access. The package itself doesn’t include authentication—always protect routes handling sensitive log data.
- What happens if my log files exceed the default 50MB size?
- Files larger than `max_file_size` (default: 50MB) are skipped with a notice. Adjust this setting in the published config file or increase it if needed, but be mindful of memory usage.
- Can I monitor logs from multiple directories or custom paths?
- Yes, configure `paths` in the config file to include multiple directories or use glob patterns like `storage/logs/*.log`. The UI will display nested directory structures for easy navigation.
- Is there an API or way to integrate this with monitoring tools?
- No, this package provides a browser-based UI only. For API access or integration with tools like Grafana, consider alternatives like Laravel Horizon or external log shippers (e.g., Filebeat).
- How do I handle log rotation or large log volumes?
- The package skips files exceeding `max_file_size` and supports pagination. For high-volume logs, pair it with Laravel’s log rotation (e.g., `log_max_files`) or external tools like logrotate or AWS S3.
- Are there alternatives for production-grade log management?
- For production, consider dedicated tools like Papertrail, Datadog, or ELK Stack for scalability and features like log analysis. This package is best for lightweight debugging in dev/staging or small teams.