79146[FEATURE] Implement simple log rotation
Commit message
Review
-
Code review CR +2 Done
- Andreas Kienast +2
- Jochen Roth +1
- Susi Moog +1
-
Verified V +2 Done
- Andreas Kienast +2
- Jochen Roth +1
- Susi Moog +1
- core-ci +1 CI
Issues 1
Files 4
- typo3/sysext/core/Classes/Log/Writer/Enum/Interval.php5new+36 −0
- typo3/sysext/core/Classes/Log/Writer/RotatingFileWriter.php7new+168 −0
- typo3/sysext/core/Documentation/Changelog/13.0/Feature-100926-IntroduceRotatingFileWriterforLogRotation.rstnew+98 −0
- typo3/sysext/core/Tests/Unit/Log/Writer/RotatingFileWriterTest.phpnew+193 −0
Review log 3950
Show 1725 earlier messages
-
Andreas Kienast uploaded patch set 1 05/25/23, 15:51
-
core-ci voted on patch set 1 V +1 05/25/23, 15:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42021
-
Andreas Kienast uploaded patch set 2
V +105/25/23, 16:21 -
core-ci voted on patch set 2 V +1 05/25/23, 16:28 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42022
-
Andreas Kienast uploaded patch set 3
V +105/26/23, 13:45 -
Andreas Kienast uploaded patch set 4 05/26/23, 13:53
-
core-ci voted on patch set 3 V -1 05/26/23, 13:59 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42050
-
core-ci voted on patch set 4 V -1 05/26/23, 14:05 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42051
-
Andreas Kienast uploaded patch set 5
V -105/28/23, 10:50 -
core-ci voted on patch set 5 V +1 05/28/23, 10:59 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42075
-
Mathias Brodala commented on patch set 5 05/30/23, 07:43
IMO this should be done as a CLI command / scheduler task instead. Benefits: - we can use existing scheduling configuration - we avoid timing issues / race conditions in case of rotating large log files at runtime -
Andreas Kienast commented on patch set 5 06/02/23, 06:32
Reply
I'm not sure how this should work if I want different rotation cycles for different log files. -
Mathias Brodala commented on patch set 5 06/05/23, 07:16
Reply Unresolved
Create multiple tasks with the same command but different config for example. -
Anja Leichsenring commented on patch set 5 06/13/23, 04:51
I like that dependency-less approach. While a scheduler or cron task also works, it relies on a working cron triggering it. Some integrator also has to set it up. This feature will work without any triggering, only once being configured, and can be forgotten forever. So +1 from me, while not opposing a potential additional CLI based task, too. -
Anja Leichsenring voted on patch set 5 CR +1 06/13/23, 04:51
-
Andreas Kienast commented on patch set 5 06/13/23, 06:00
Reply
I'd like to get more feedback on this, please. If the vast majority opts for a scheduler task, I can of course change the patch. -
Andreas Kienast uploaded patch set 6
CR +1V +106/16/23, 08:00 -
Andreas Kienast uploaded patch set 7 06/16/23, 08:03
-
core-ci voted on patch set 6 V -1 06/16/23, 08:16 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42721
-
core-ci voted on patch set 7 V -1 06/16/23, 08:18 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42723
-
Andreas Kienast commented on patch set 7 V -1 06/16/23, 08:34
The patch breaks the Install Tool (for me) /o\ -
Andreas Kienast uploaded patch set 8
V -106/16/23, 09:18 -
core-ci voted on patch set 8 V +1 06/16/23, 09:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42729
-
Markus Klein commented on patch set 8 06/16/23, 14:31
RotatingFileWriter.php:42Any specific reason to use a ResourceMutex here instead of just a simple lock? -
Andreas Kienast commented on patch set 8 06/16/23, 17:13
RotatingFileWriter.php:42ReplyI honestly didn‘t fully understand how I should configure the lock (exclusive, shared, etc.) and didn‘t find any usage in Core but the ResourceMutex.
-
Markus Klein commented on patch set 8 06/16/23, 17:46
RotatingFileWriter.php:42ReplyAlright. I'll do a take on that one then, if you don't mind. Basically: If you need to have a look for an potentially endless number of resources (like pages), then use ResourceMutex. Otherwise a simple exclusive lock is sufficient. -
Markus Klein uploaded patch set 9
V +106/16/23, 17:56 -
Markus Klein commented on patch set 9 06/16/23, 17:57
RotatingFileWriter.php:42ReplyDone -
core-ci voted on patch set 9 V -1 06/16/23, 18:07 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/42748
-
Christoph Lehmann commented on patch set 9 06/16/23, 18:42
Pretty nice feature! I prefer to rotate on the maximum filesize rather than on interval. At some hosters, log files don't grow above 2GB and new lines get lost, so from my point of view the filesize should be default reason for logrotation and the interval cooouuld be an option. https://github.com/cesargb/php-log-rotation looks like a nice source. By leaving away the interval option we don't need a cli task doing the rotation. Furthermore i would like the feature in the TYPO3 defaults FileWriter, not a new one, that needs to be configured manually (to have strong defaults). The minimum/maximum filesize and maximum number of could be defined in DefaultConfiguration.php and might be overwritten in LogWriter configuration. -
Christoph Lehmann commented on patch set 9 06/16/23, 18:49
Reply
On the other hand.. the interval is also nice, but then please keep .log as the file extension and not the date. -
Markus Klein commented on patch set 9 06/17/23, 07:30
Reply
I think Andy used Linux's logrotate as template, which appends the date -
Andreas Kienast commented on patch set 9 06/29/23, 08:06
Reply
Indeed. Also, with the date I'm able to determine when the last rotation happened without the need to store the timestamp somewhere else. The filesize aspect is something I'd like to introduce in a separate patch if really necessary. Also, this is just a bare-minimum implementation which shall not replace `logrotate`. -
Andreas Kienast commented on patch set 9 CR -1 06/29/23, 08:13
RotatingFileWriter.php:83phpstan reports this line with "Right side of && is always true." which is true as the outer condition evaluated to `true` before. The issue is there's no code in between that alters `$this->nextRotation` or `$this->lastRotation`. -
Markus Klein commented on patch set 9 06/29/23, 08:18
RotatingFileWriter.php:83ReplyRight, I missed that needsRotation does not update it's data. We need to update the lastRotation/nextRotation information in this method -
Andreas Kienast uploaded patch set 10
CR -1V -106/29/23, 12:47 -
Andreas Kienast commented on patch set 10 06/29/23, 12:47
RotatingFileWriter.php:83ReplyDone -
core-ci voted on patch set 10 V +1 06/29/23, 12:54 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43112
-
Markus Klein voted on patch set 10 CR +1 07/03/23, 21:40
-
Susi Moog voted on patch set 10 V +1 CR +1 07/07/23, 12:29
-
Jochen Roth voted on patch set 10 V +1 CR +1 07/07/23, 22:33
-
Oliver Klee commented on patch set 10 07/08/23, 07:29
Interval.php:3Please let's make this file strict.Interval.php:25Can we have a simple test for this method? -
Andreas Kienast commented on patch set 10 07/10/23, 05:48
Interval.php:3ReplyAckInterval.php:25ReplyA test for a getter method with basically no logic? If something breaks *here*, other tests will fail anyway. -
Andreas Kienast uploaded patch set 11
CR +1V +107/10/23, 05:49 -
core-ci voted on patch set 11 V +1 07/10/23, 05:56 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/43965
-
Susi Moog voted on patch set 11 V +1 CR +1 07/10/23, 07:16
-
Jochen Roth voted on patch set 11 V +1 CR +1 07/10/23, 07:33
-
Oliver Klee commented on patch set 11 07/10/23, 07:37
Interval.php:25ReplyYes, that's true. The idea of having tests for more classes in a call stack is that you won't only notice _that_ something is broken, but it will also help locate you _what_ is broken (which can be a big time-saver for debugging). -
Andreas Kienast voted on patch set 11 V +2 CR +2 07/10/23, 07:51
-
Andreas Kienast merged patch set 12 07/10/23, 07:51