If you are running a Laravel project on a Linux server (LAMP / XAMPP / Apache) and your laravel.log file is not being created, don’t worry — this is a very common issue.
In this guide, we will fix the problem step by step.
Problem Overview
- Cache files are being generated
- Website is running properly
- But
storage/logs/laravel.logis NOT being created
In most cases, this happens due to:
- Storage permission issues
- Missing logs folder
- Incorrect logging configuration
- Config cache not cleared
Step 1: Confirm Laravel Installation
Go to your project root directory and run:
ls
If you see folders like:
artisan
app
routes
storage
bootstrap
Then Laravel is properly installed.
Step 2: Check if Logs Folder Exists
Laravel stores logs inside:
storage/logs/
Run:
ls storage
If you do NOT see a logs folder, create it manually:
mkdir storage/logs
Step 3: Fix Storage Permissions (Most Important Step)
Permission issues are the #1 reason logs don’t generate on Linux.
Run:
sudo chmod -R 775 storage
sudo chmod -R 775 bootstrap/cache
For testing purposes only, you can temporarily use:
sudo chmod -R 777 storage
sudo chmod -R 777 bootstrap/cache
⚠️ Do NOT use 777 in production.
Step 4: Fix Apache Ownership
If Apache runs as www-data, execute:
sudo chown -R www-data:www-data storage
sudo chown -R www-data:www-data bootstrap/cache
If you are using XAMPP on Linux, run:
sudo chown -R daemon:daemon storage
sudo chown -R daemon:daemon bootstrap/cache
Step 5: Check .env Logging Configuration
Open your .env file:
nano .env
Ensure the following lines exist:
LOG_CHANNEL=stack
LOG_LEVEL=debug
APP_DEBUG=true
Save the file.
Step 6: Clear Laravel Cache & Config
Sometimes configuration cache prevents logs from generating.
Run:
php artisan config:clear
php artisan cache:clear
php artisan config:cache
This step is very important.
Step 7: Manually Test Log Creation
Add this temporary route inside routes/web.php:
use Illuminate\Support\Facades\Log;
Route::get('/testlog', function () {
Log::error('Test log working');
return 'done';
});
Now open in your browser:
http://localhost/your-project/public/testlog
Then check:
ls storage/logs
If laravel.log appears — logging is working
Advanced Check: config/logging.php
Open:
nano config/logging.php
Make sure this line exists:
'default' => env('LOG_CHANNEL', 'stack'),
Also confirm that the stack channel is properly configured.
Final Conclusion
In 99% of cases, Laravel log issues happen due to:
✔ Storage permission problems
✔ Missing logs folder
✔ Incorrect ownership
✔ Config cache not cleared
Once these are fixed, laravel.log will start generating normally.