Top Related Projects
:page_with_curl: Provides a log viewer for Laravel
Fast and beautiful Log Viewer for Laravel
Laravel N+1 Query Detector
Debugbar for Laravel (Integrates PHP Debug Bar)
Clockwork - php dev tools in your browser - server-side component
Quick Overview
Laravel Log Viewer is a package that provides a user-friendly interface for viewing Laravel application logs directly in the browser. It offers a simple way to access and analyze log files without the need to SSH into the server or download log files manually.
Pros
- Easy installation and integration with Laravel projects
- User-friendly interface for browsing and searching log entries
- Supports viewing multiple log files
- Customizable access control for security
Cons
- Limited advanced filtering options
- May impact performance if used on production servers with large log files
- Lacks real-time log streaming capabilities
- No built-in log analysis or visualization features
Code Examples
- Basic setup in
routes/web.php
:
use Rap2hpoutre\LaravelLogViewer\LogViewerController;
Route::get('logs', [LogViewerController::class, 'index']);
- Customizing the log files path:
use Rap2hpoutre\LaravelLogViewer\LogViewerController;
Route::get('logs', function () {
return (new LogViewerController())->setLogPath(storage_path('logs/custom'))->index();
});
- Adding middleware for access control:
Route::get('logs', [LogViewerController::class, 'index'])
->middleware('auth');
Getting Started
-
Install the package via Composer:
composer require rap2hpoutre/laravel-log-viewer
-
Add the route to your
routes/web.php
file:use Rap2hpoutre\LaravelLogViewer\LogViewerController; Route::get('logs', [LogViewerController::class, 'index']);
-
Access the log viewer by navigating to
http://your-app-url/logs
in your browser. -
(Optional) Publish the config file for customization:
php artisan vendor:publish --provider="Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider"
Competitor Comparisons
:page_with_curl: Provides a log viewer for Laravel
Pros of LogViewer
- More feature-rich with advanced filtering, searching, and statistics
- Customizable dashboard with charts and graphs
- Better support for multi-file logs and large log files
Cons of LogViewer
- More complex setup and configuration
- Heavier resource usage due to additional features
- Steeper learning curve for customization
Code Comparison
LogViewer configuration:
'pattern' => [
'prefix' => '^.+',
'date' => '\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}',
'env' => 'local|production|testing',
'level' => 'emergency|alert|critical|error|warning|notice|info|debug',
'channel' => '[\w-]+',
'message' => '[\s\S]*',
],
laravel-log-viewer implementation:
$pattern = "/\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}\].*/";
$log_levels = ['emergency', 'alert', 'critical', 'error', 'warning', 'notice', 'info', 'debug'];
LogViewer offers more granular control over log parsing patterns, while laravel-log-viewer uses a simpler approach. This reflects the overall difference in complexity and customization options between the two packages.
Fast and beautiful Log Viewer for Laravel
Pros of log-viewer
- More feature-rich with advanced filtering, searching, and log management capabilities
- Offers a modern, responsive UI with dark mode support
- Supports multiple log channels and file types
Cons of log-viewer
- Requires more setup and configuration compared to laravel-log-viewer
- May have a steeper learning curve for beginners due to its advanced features
Code Comparison
laravel-log-viewer:
Route::get('logs', '\Rap2hpoutre\LaravelLogViewer\LogViewerController@index');
log-viewer:
use Opcodes\LogViewer\Facades\LogViewer;
Route::get('logs', function () {
return LogViewer::getFiles();
});
The laravel-log-viewer package provides a simple, out-of-the-box solution with minimal setup, while log-viewer offers more flexibility and customization options. log-viewer requires more configuration but provides a more robust set of features for managing and analyzing logs in Laravel applications.
Both packages serve the purpose of viewing Laravel logs, but log-viewer is better suited for larger applications with complex logging requirements, while laravel-log-viewer is ideal for smaller projects or quick implementations.
Laravel N+1 Query Detector
Pros of Laravel Query Detector
- Focuses specifically on detecting and alerting about N+1 queries, which can significantly impact performance
- Provides real-time notifications in the browser console or as an alert, making it easier to catch issues during development
- Offers customizable thresholds for query count and execution time
Cons of Laravel Query Detector
- Limited to query detection and doesn't provide a comprehensive log viewing solution
- May add some overhead to the application, especially if used in production environments
- Requires additional setup and configuration compared to a simple log viewer
Code Comparison
Laravel Query Detector:
QueryDetector::logQuery($query, $bindings, $time);
Laravel Log Viewer:
$logs = LaravelLogViewer::all();
Summary
Laravel Query Detector is a specialized tool for identifying N+1 query issues, offering real-time notifications and customizable thresholds. It's particularly useful during development but may add some overhead.
Laravel Log Viewer, on the other hand, provides a more general-purpose log viewing solution, allowing developers to easily access and browse application logs through a web interface.
While Laravel Query Detector focuses on a specific performance issue, Laravel Log Viewer offers a broader view of application logs, making it easier to troubleshoot various types of issues.
The choice between these tools depends on the specific needs of the project and the development team's priorities regarding performance optimization and log management.
Debugbar for Laravel (Integrates PHP Debug Bar)
Pros of Laravel Debugbar
- Provides real-time debugging information in a toolbar
- Offers extensive performance profiling and query analysis
- Integrates with Laravel's built-in features like events and routes
Cons of Laravel Debugbar
- Can impact application performance when enabled
- Requires more setup and configuration
- May expose sensitive information if not properly secured
Code Comparison
Laravel Debugbar:
use Barryvdh\Debugbar\Facade as Debugbar;
Debugbar::info('Info message');
Debugbar::error('Error message');
Debugbar::warning('Warning message');
Debugbar::addMessage('Another message', 'mylabel');
Laravel Log Viewer:
use Rap2hpoutre\LaravelLogViewer\LaravelLogViewer;
$logs = LaravelLogViewer::all();
foreach ($logs as $log) {
echo $log['date'] . ' ' . $log['level'] . ': ' . $log['text'];
}
Laravel Debugbar offers more comprehensive debugging features with real-time information and performance profiling, while Laravel Log Viewer focuses specifically on log file viewing and management. Debugbar provides a more interactive experience but may have a higher performance impact, whereas Log Viewer is lighter and simpler to use but with more limited functionality.
Clockwork - php dev tools in your browser - server-side component
Pros of Clockwork
- More comprehensive debugging and profiling capabilities
- Real-time monitoring of application performance
- Supports multiple data sources (database queries, cache, etc.)
Cons of Clockwork
- More complex setup and configuration
- Higher resource usage due to extensive monitoring
- Steeper learning curve for full utilization
Code Comparison
Laravel-log-viewer:
Route::get('logs', '\Rap2hpoutre\LaravelLogViewer\LogViewerController@index');
Clockwork:
// In app/Http/Kernel.php
protected $middleware = [
// ...
\Clockwork\Support\Laravel\ClockworkMiddleware::class,
];
Laravel-log-viewer provides a simple, lightweight solution for viewing Laravel logs directly in the browser. It's easy to set up and requires minimal configuration. However, it focuses solely on log files and doesn't offer real-time monitoring or advanced profiling features.
Clockwork, on the other hand, is a more powerful debugging and profiling tool. It offers real-time insights into application performance, including database queries, cache operations, and more. While it requires more setup and resources, it provides a more comprehensive view of your application's behavior.
Choose Laravel-log-viewer for quick and easy log viewing, or opt for Clockwork when you need in-depth debugging and profiling capabilities.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Laravel log viewer
TL;DR
Log Viewer for Laravel 5, 6, 7, 8, 9 & 10 (still compatible with 4.2 too) and Lumen. Install with composer, create a route to LogViewerController
. No public assets, no vendor routes, works with and/or without log rotate. Inspired by Micheal Mand's Laravel 4 log viewer (works only with laravel 4.1)
What ?
Small log viewer for laravel. Looks like this:
Install (Laravel)
Install via composer
composer require rap2hpoutre/laravel-log-viewer
Add Service Provider to config/app.php
in providers
section
Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class,
Add a route in your web routes file:
Route::get('logs', [\Rap2hpoutre\LaravelLogViewer\LogViewerController::class, 'index']);
Go to http://myapp/logs
or some other route
Install (Lumen)
Install via composer
composer require rap2hpoutre/laravel-log-viewer
Add the following in bootstrap/app.php
:
$app->register(\Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider::class);
Explicitly set the namespace in app/Http/routes.php
:
$router->group(['namespace' => '\Rap2hpoutre\LaravelLogViewer'], function() use ($router) {
$router->get('logs', 'LogViewerController@index');
});
Advanced usage
Customize view
Publish log.blade.php
into /resources/views/vendor/laravel-log-viewer/
for view customization:
php artisan vendor:publish \
--provider="Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider" \
--tag=views
Edit configuration
Publish logviewer.php
configuration file into /config/
for configuration customization:
php artisan vendor:publish \
--provider="Rap2hpoutre\LaravelLogViewer\LaravelLogViewerServiceProvider"
Troubleshooting
If you got a InvalidArgumentException in FileViewFinder.php
error, it may be a problem with config caching. Double check installation, then run php artisan config:clear
.
Top Related Projects
:page_with_curl: Provides a log viewer for Laravel
Fast and beautiful Log Viewer for Laravel
Laravel N+1 Query Detector
Debugbar for Laravel (Integrates PHP Debug Bar)
Clockwork - php dev tools in your browser - server-side component
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot