D
D
dinya172018-09-20 12:44:46
Yii
dinya17, 2018-09-20 12:44:46

How to do logging to files and archiving them in Yii2?

Good afternoon.
There is a project on Yii2, all errors are caught and written to files by the standard framework method.
A certain file size, file name and number of files are set. But in fact, this is not enough, everything that is caught is logged into these files, but there are many events and they are all eventually lost after an hour or two of system operation.
Task:
- write all the events of the day to files
- archive the file and store it at the end of the day
- also send logs to elastic (no problems here), a monologue is used
Question:
Are there any ready-made solutions for my task? To have file autorotation and packing from to archive

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-09-20
@dinya17

Logging can be configured as you like, here is the guide:
https://www.yiiframework.com/doc/guide/2.0/en/runt...
You can choose the place where your logs will fall. But archiving is already cron. Let's run it once a day, take it from the specified location, archive it, delete the old one, etc.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question