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

Technical Evaluation

Architecture Fit

  • Pros:
    • Native Laravel Integration: Designed for Laravel’s ecosystem, leveraging its logging system (Monolog) and Blade templating. No external dependencies or infrastructure required.
    • Minimal Overhead: Lightweight (~100KB) with no public assets or vendor routes, reducing attack surface.
    • Log Rotation Support: Handles Laravel’s default daily log rotation (e.g., laravel-2024-05-10.log) out-of-the-box, aligning with Laravel’s logging best practices.
    • Extensible: Supports view customization (Blade templates) and configuration overrides, enabling alignment with team UI standards.
  • Cons:
    • Single-Server Focus: Only reads logs from the local filesystem. Multi-server or containerized environments (e.g., Docker swarm, Kubernetes) require additional tooling (e.g., log aggregation).
    • No Structured Logging: Parses raw log lines; lacks features like JSON parsing, filtering by log level, or query-based searches (e.g., "show all SQLSTATE[42S22] errors").
    • Laravel-Centric: Tight coupling to Laravel’s logging format may limit reuse in polyglot or non-Laravel PHP projects.

Integration Feasibility

  • Low Barrier to Entry: Installation requires 3 steps (Composer, service provider, route), with no breaking changes for Laravel 11–13.
  • Compatibility:
    • Supported: Laravel 12/13 (primary), Lumen (legacy), and older versions via tagged releases.
    • Unsupported: Logs compressed with gzip or stored in remote systems (e.g., S3, Syslog). Requires pre-processing for these cases.
  • Dependencies:
    • Hard: PHP 8.1+, Laravel Framework (core dependency).
    • Soft: Blade templating (for custom views), Monolog (for log parsing).

Technical Risk

  • Critical Risks:
    • Log File Permissions: Fails silently if logs are unreadable (e.g., storage/logs/ owned by wrong user). Requires explicit permission checks in CI/CD or deployment scripts.
    • Config Cache: InvalidArgumentException in FileViewFinder.php is a known issue tied to cached configs. Mitigate with php artisan config:clear in deployment hooks.
    • Production Exposure: Unprotected /logs route could leak sensitive data (e.g., stack traces, API keys). Must be secured with middleware (e.g., auth, admin).
  • Moderate Risks:
    • Performance: Large log files (>50MB) may cause timeouts or memory issues. Test under load in staging.
    • Customization Complexity: Overriding the controller or views requires familiarity with Laravel’s service container and Blade.
  • Low Risks:
    • Maintenance: MIT-licensed with active contributions (last release: 2026-05-12). Backward-compatible for Laravel LTS versions.

Key Questions

  1. Security:
    • How will the /logs route be protected in production? (e.g., IP whitelisting, OAuth, or internal-only access?)
    • Are logs stored in non-default locations (e.g., S3, remote DB)? If so, how will this package be adapted?
  2. Scalability:
    • Will this be used in multi-server environments? If yes, how will logs be aggregated? (e.g., Logstash, Fluentd)
    • What’s the expected log volume? Are there plans to archive old logs?
  3. Customization:
    • Does the team need to modify the UI (e.g., add syntax highlighting, export buttons)? If so, is the Blade template extensible enough?
    • Are there requirements for log filtering (e.g., by severity, custom tags) beyond what the package offers?
  4. Compliance:
    • Do logs contain PII or regulated data (e.g., HIPAA, GDPR)? If yes, how will access be audited?
  5. Monitoring:
    • Will this replace existing log monitoring (e.g., Sentry, Datadog)? If not, how will alerts be correlated?

Integration Approach

Stack Fit

  • Ideal For:
    • Laravel Monoliths: Single-server or multi-server apps where logs are stored locally.
    • Dev/Staging Environments: Teams needing quick, ad-hoc log inspection without SSH.
    • Small-to-Medium Teams: Projects where engineering time is better spent on core features than building a log viewer.
  • Poor Fit:
    • Microservices: Logs distributed across containers/servers require aggregation (e.g., ELK, Loki).
    • High-Security Environments: Production systems with strict audit requirements (e.g., financial, healthcare).
    • Polyglot Stacks: Non-Laravel PHP apps or mixed-language services.

Migration Path

  1. Assessment Phase:
    • Audit current logging setup: Verify log locations, rotation policies, and permissions.
    • Test in a staging environment with a sample log file (>10MB) to validate performance.
  2. Installation:
    • Add to composer.json and run composer install.
    • Register the service provider in config/app.php (or bootstrap/app.php for Lumen).
    • Add the route to routes/web.php with middleware (e.g., Route::get('logs', ...)->middleware('auth')).
  3. Configuration:
    • Publish and customize config/logviewer.php if logs are in non-default locations.
    • Publish log.blade.php if UI changes are needed (e.g., branding, additional controls).
  4. Validation:
    • Test log visibility for critical scenarios (e.g., 500 errors, queue failures).
    • Verify performance with ab or Chrome DevTools (target <2s load time).

Compatibility

  • Laravel 12/13: Full support with zero changes.
  • Laravel 11: Works but may require config:clear due to cached views.
  • Legacy Versions: Use tagged releases (e.g., v1.7.0 for Laravel 6–10).
  • Custom Loggers: If using non-Monolog loggers (e.g., syslog, monit), ensure the package’s file reader can parse the output.
  • Log Rotation: Supports Laravel’s daily rotation but not compressed logs (.gz). Disable compression in config/logging.php if needed:
    'daily' => [
        'driver' => 'single',
        'path' => storage_path('logs/laravel.log'),
        'level' => env('LOG_LEVEL', 'debug'),
        'days' => 14,
        // Remove or set 'compress' => false
    ],
    

Sequencing

  1. Phase 1 (Dev/Staging):
    • Install and secure the route for internal use.
    • Customize views/config if needed.
  2. Phase 2 (Production):
    • Restrict access to specific IPs/roles.
    • Monitor performance and log readability.
  3. Phase 3 (Advanced):
    • Extend functionality (e.g., add export buttons, integrate with alerting).
    • Replace with a centralized solution if logs grow beyond 100MB/day.

Operational Impact

Maintenance

  • Pros:
    • Low Effort: No dependencies to update; follows Laravel’s release cycle.
    • Self-Healing: Issues like config cache are documented and fixable with config:clear.
    • Community Support: GitHub issues are responsive (e.g., PRs for daily logs, readability errors).
  • Cons:
    • No Official Support: MIT license means no SLA or vendor assistance.
    • Custom Code Risk: Overriding the controller/views requires maintaining forks if the package evolves.

Support

  • Troubleshooting:
    • Common Issues:
      • 404 on /logs: Missing route or service provider. Verify RouteServiceProvider boots the package.
      • Blank Page: Config cache issue. Run php artisan config:clear.
      • Permission Denied: Check storage/logs/ permissions (chmod -R 755 storage/logs).
    • Debugging Tools:
      • Use Laravel’s tail -f storage/logs/laravel.log to verify logs are being written.
      • Check storage/framework/views for cached Blade errors.
  • Escalation Path:
    • Open GitHub issues for package bugs.
    • Fork and submit PRs for custom features (e.g., log filtering).

Scaling

  • Performance Limits:
    • Log Size: >50MB files may cause timeouts. Mitigate by:
      • Truncating logs in production (e.g., keep last 7 days).
      • Using logrotate to split files.
    • Concurrent Access: Not optimized for high traffic. Use middleware to throttle or restrict access.
  • Horizontal Scaling:
    • Not Supported: Only reads local logs. For distributed systems:
      • Aggregate logs
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.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai