Log File Location
The primary application log is at:
storage/logs/laravel.log
This file captures all application-level events: errors, warnings, queued job failures, email send attempts, and anything your code explicitly logs.
With the default single channel, all output goes to this one file. For per-day rotation, set LOG_CHANNEL=daily in .env and run php artisan config:clear. Daily logs are created as storage/logs/laravel-YYYY-MM-DD.log.
Log Levels
| Level | Meaning |
|---|---|
DEBUG |
Verbose development output — usually too noisy in production |
INFO |
Normal application events (job started, email queued) |
WARNING |
Non-fatal issue that should be reviewed |
ERROR |
A specific operation failed, but the app is still running |
CRITICAL |
Serious failure — application may be in a bad state |
In production, LOG_LEVEL=warning or LOG_LEVEL=error in .env reduces noise while keeping important events visible.
Reading a Stack Trace
When an exception is logged, it looks like this:
[2026-04-15 14:22:10] production.ERROR: Class 'App\Services\RegistrarService' not found
#0 app/Jobs/RegisterDomainJob.php(42): App\Http\Controllers\DomainController->register()
#1 vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(83): ...
When reading a stack trace:
- First line — the exception class and message. This is the actual error.
- Lines starting with
#0,#1— the call stack showing how execution reached the error. - Focus on lines containing
app/— those are your application code, not framework internals. Framework lines are rarely where the bug is.
Common Log Patterns
SQLSTATE[23000]: Integrity constraint violation: Duplicate entry
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'user@example.com' for key 'clients_email_unique'
Meaning: You tried to insert a record that violates a unique constraint — typically a duplicate email during client import.
Fix: Remove the duplicate from your import CSV, or update the existing record instead of inserting.
Connection refused
Swift_TransportException: Connection could not be established with host smtp.example.com (stream_socket_client(): Unable to connect to tcp://smtp.example.com:587 (Connection refused))
Meaning: SMTP server is unreachable — wrong host, wrong port, or SMTP server is down. Also appears for queue worker trying to connect to a stopped service.
Fix: Verify MAIL_HOST and MAIL_PORT in .env.
Class not found
Class 'App\Modules\Registrars\Enom\EnomModule' not found
Meaning: Composer's autoload map is stale.
Fix:
composer dump-autoload
No application encryption key
RuntimeException: No application encryption key has been specified.
Meaning: APP_KEY is missing or empty in .env.
Fix:
php artisan key:generate
Clearing the Log File
Do not delete laravel.log — the file handle may still be held by PHP-FPM. Truncate instead:
> storage/logs/laravel.log
Or on Windows:
type nul > storage\logs\laravel.log
Log Rotation
For production, use daily log rotation:
- Set
LOG_CHANNEL=dailyin.env. - Run
php artisan config:clear. - Old daily files accumulate in
storage/logs/. Clean up files older than 30 days with a cron job:find /opt/opterius/storage/logs -name "laravel-*.log" -mtime +30 -delete
[!TIP] When investigating an issue, always check the log timestamp against when the problem was reported. A stack trace from three days ago may be unrelated to what you're diagnosing today.