vendor/), reducing friction for developers.composer require). Enabled via environment variable (ELOQUENT_LOGGER_ENABLED=true).storage/logs/).LONGTEXT/BLOB fields (OS/filesystem-dependent).WHERE clauses) in logged queries?laravel-debugbar for real-time query analysis.blackfire/php for deep query profiling.Laravel Telescope for centralized review.composer.json:
"require-dev": {
"rstriquer/eloquent-logger": "^1.0"
}
.env:
ELOQUENT_LOGGER_ENABLED=true
ELOQUENT_LOGGER_FILE=eloquent.log
APP_ENV checks).PDO (standard in Laravel).request_id)..env.CONTRIBUTING.md with best practices (e.g., log analysis workflows).ELOQUENT_LOGGER_ENABLED and storage/logs/ permissions.tail -f storage/logs/eloquent.log for real-time monitoring.storage/logs/laravel.log) for package errors.spatie/laravel-query-logger (more active maintenance) if support is critical.// app/Console/Commands/CleanEloquentLogs.php
public function handle() {
$logPath = storage_path('logs/eloquent.log');
if (filesize($logPath) > 10_000_000) { // 10MB
file_put_contents($logPath, '');
}
}
| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Log file exceeds filesystem limits | Silent corruption/failure to log | Monitor size; use NTFS/ext4 |
| High query volume in dev | Disk I/O saturation | Disable during peak usage |
| Sensitive data in logged queries | Compliance/privacy risk | Sanitize logs or use a VPN/dev network |
| Package conflicts with other logs | Overlapping log files | Rename log file (e.g., eloquent.sql) |
| Laravel upgrade breaks listener | Logging stops working | Test on staging before production upgrade |
User::with('posts')->get() query, enable logging and check for N+1 issues."How can I help you explore Laravel packages today?