Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to delete logs by laravel

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the relevant knowledge of "how laravel deletes the log". The editor shows you the operation process through the actual case. The operation method is simple, fast and practical. I hope this article "how to delete the log in laravel" can help you solve the problem.

In laravel, you can use the truncate command to delete the log, which is used to empty the specified data and use this command to empty the contents of the "laravel.log" file with the syntax of "truncate-s 0 storage/logs/laravel.log".

This article operating environment: Windows10 system, Laravel6 version, Dell G3 computer.

How does laravel delete the log?

1. How to delete (empty) laravel.log files in Laravel

Sometimes phpstorm can't open this file because it's too big.

Laravel.log files can not be emptied manually, such as opening files, selecting all delete will not have any effect.

There is a simple command to empty the laravel.log file using the

Enter this command at the command line

Truncate-s 0 storage/logs/laravel.log

II. Custom log

For example, I have an SMS log that I need to write, but I don't want to write to laravel.log. What should I do? it's very simple to add a driver to config/logging.php directly.

'sms' = > [' driver' = > 'daily',// single file or by day' path' = > storage_path ('logs/sms.log'), / / store file' level' = > 'info',// log level' days' = > 14 gamble / time period]

Call:

Log::channel ('sms')-> info (' SMS content') this is the end of the introduction on "how to delete logs in laravel". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report