Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In PHP's Laravel, how do I clear laravel.log?

Tags:

php

laravel-4

I'm new to Laravel and PHP in general, and I'm trying to clear my errorLog. The current errorlog that I'm using is Laravel's laravel.log file that is in /app/storage/logs.

Is there an easy way to clear the laravel.log file? Is it safe to delete it and it'll rebuild when needed?

I'm using the latest version of Ubuntu. Thanks!

like image 929
Obelisk47 Avatar asked Jan 24 '15 16:01

Obelisk47


People also ask

Can I delete Laravel logs?

If you're having a space problem you can try using daily logs, it will automatically keep last X days of log (default 5). You can see it in Errors & Logging - Log Storage. Otherwise you can simply remove the storage/logs/laravel. log file or make a command to do so (like php artisane log:clear ).

Where are Laravel logs stored?

By default, Laravel is configured to create a single log file for your application, and this file is stored in app/storage/logs/laravel. log .

How do I view Laravel logs?

You can see the generated log entries in storage/logs/laravel. log file.

How do I disable Laravel logging?

go to vendor->laravel->framework->src->Illuminate->Log->Writer. php and then comment out all the code within function __call like below. You log will never be save.


1 Answers

Echoing an empty string to it would work, like this :

echo "" > storage/logs/laravel.log 

The most efficient would be to truncate it to a size of zero :

truncate -s 0 /app/storage/logs/laravel.log 
like image 70
3 revs, 2 users 80%user2629998 Avatar answered Oct 11 '22 11:10

3 revs, 2 users 80%user2629998