copona icon indicating copy to clipboard operation
copona copied to clipboard

system/storage/log/error.txt rotation

Open arnisjuraga opened this issue 7 years ago • 7 comments

This file can grow up in time. Is there any method, which rewrites and "rotates" this file?

Of course, for security, there can be minimum history which needs to be allowed, but it could be configurable. By default, set to 7 days e.g., and after that, log file is removed/renamed/compressed/archived?

arnisjuraga avatar Mar 02 '17 10:03 arnisjuraga

We could just have daily logs, weekly or monthly logs.

lucasjkr avatar Mar 02 '17 13:03 lucasjkr

I think this should be done by the operating system. It would be good to use monolog or at least psr-3 logger interface

stefanhuber avatar May 19 '17 16:05 stefanhuber

When you are using shared hosting (although, at the moment you still need a composer. But the release will be compiled for shared), you probably will not get hoster to rotate application logs. I would say that logs could be a per-weekday basis. At least - configurable in admin.

arnisjuraga avatar May 19 '17 17:05 arnisjuraga

Ok. One needs cronjobs for that? This is also something which is not available maybe on shared hosting.

stefanhuber avatar May 26 '17 06:05 stefanhuber

e.g. if you have custom application and you put some .log file under, let's say myapp/here/logs.log - hosting must know, that it's needed to "rotated" these log files.

May be some Hosting companies has custom configuration, to rotate application log files.

I you have dedicated server, of course, you can set up logrotate serviss as you wish.

I believe, that vqmod approach to log files automatically, with prefixes or suffixes of weekdays is quite enough though?

arnisjuraga avatar May 26 '17 06:05 arnisjuraga

https://seldaek.github.io/monolog/doc/02-handlers-formatters-processors.html#log-to-files-and-syslog monolog has a rotatingfilehandler build in

stefanhuber avatar Jun 06 '17 16:06 stefanhuber

Seems to be the perfect solution, together with Whoops? https://github.com/filp/whoops/issues/62

In Production environment, Whoops must be turned off, but the logging still should be available. If it's possible to achieve with both of them?

RaidoDev avatar Jun 06 '17 17:06 RaidoDev