Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Log Viewer Laravel Package

rap2hpoutre/laravel-log-viewer

View Laravel and Lumen log files in the browser with a lightweight log viewer. Install via Composer, register the service provider, and add a single route to LogViewerController—no public assets or vendor routes. Works with rotated logs.

View on GitHub
Deep Wiki
Context7

Getting Started

Install the package via Composer, register the service provider, and add a simple route to view logs in the browser:

composer require rap2hpoutre/laravel-log-viewer

In config/app.php (or bootstrap/app.php for Lumen), add:

Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class,

Define a route in routes/web.php:

Route::get('logs', [\Rap2hpoutre\LaravelLogViewer\LogViewerController::class, 'index']);

Visit /logs to see an interactive, color-coded log viewer with search and filtering. First-time users should check the troubleshooting tip about clearing config cache if they encounter view resolution errors.


Implementation Patterns

  • Quick Debugging: Ideal for dev and staging environments—just open /logs to inspect recent errors, warnings, and info messages.
  • Production Safety: Lock access using middleware (e.g., auth or admin) to prevent exposing sensitive logs:
    Route::get('logs', [...])->middleware('auth');  
    
  • Custom View Styling: Publish the log.blade.php view via vendor:publish --tag=views to match your app’s UI or add custom highlighting.
  • Configurable Log Location: Update config/logviewer.php (published via vendor:publish) to point to non-default log paths (e.g., storage/logs/custom.log).
  • Daily Log Support: Automatically handles Laravel’s daily log channels—no extra config needed beyond ensuring logs follow laravel-{date}.log naming.

Gotchas and Tips

  • Laravel 11+ Compatibility: Works out-of-the-box, but always run php artisan config:clear after installation or config changes—cached configs commonly break view resolution.
  • Readability Errors: If you see “File not readable” exceptions, verify file permissions (e.g., storage/logs/ owned by www-data/apache).
  • Log Rotation Confusion: The package does not support compressed logs (e.g., .gz). Ensure your logging config doesn’t auto-compress logs.
  • Performance Overhead: Avoid enabling in high-traffic production; even though it’s lightweight, large log files (>100MB) will slow page loads. Consider restricting access or truncating logs in prod.
  • Extending the Controller: Override LogViewerController by extending it and swapping routes—e.g., to add date range filtering or export functionality.
  • Security: Never commit logviewer.php config or log view customizations to public repos—log files often contain credentials or PII.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport