ItSolutionStuff.com

How to Clear Log File using Command in Laravel?

By Hardik Savani • November 5, 2023
Laravel

I was working on my laravel project, i found one issue that too much load my log file when i open and i want to remove that data, i mean hang my system and must need to restart my system. I thought what will issue, but i got it because in my laravel.log(/storage/logs/laravel.log) file had big size of data and my text editor can't load and i want to clear that's way i can see other error.

I did search on google at last i found the solution using command, we have to just run command in out terminal or cmd and we can remove all data of log file. So let's fire bellow command and check.

You can use following two example command:

Example 1:

truncate -s 0 storage/logs/laravel.log

Example 2:

echo "" > storage/logs/laravel.log

I hope it can help you...

Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

Laravel Login with Mobile Number OTP Tutorial

Read Now →

Laravel Login and Registration using Ajax Tutorial

Read Now →

Laravel Passwordless Login with Magic Link Tutorial

Read Now →

Laravel Custom Login and Registration Example

Read Now →

How to Create Custom Log File in Laravel?

Read Now →

How to Delete File from Public Folder / Storage Folder in Laravel?

Read Now →

How to Display Image from Storage Folder in Laravel?

Read Now →

Laravel Generate PDF from HTML View File and Download Example

Read Now →

How to use Login Throttle in Laravel?

Read Now →

Laravel Login with Linkedin using Socialite Package

Read Now →

How to Get Logged in User Data in Laravel?

Read Now →

How to Check User Login or Not in Laravel?

Read Now →

Laravel Redirect Back to Previous Page After Login Example

Read Now →

How to Get Query Log in Laravel Eloquent?

Read Now →