-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix file logging log rotation #98216
base: master
Are you sure you want to change the base?
Conversation
bd18983
to
5013221
Compare
5013221
to
a94209d
Compare
Friendly remainder |
a94209d
to
25ac8bc
Compare
tests/core/io/test_logger.h
Outdated
|
||
namespace TestLogger { | ||
|
||
const int sleep_duration = 1200000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const int sleep_duration = 1200000; | |
constexpr int sleep_duration = 1200000; |
Also, can we use a shorter sleep duration? This is 1.2 seconds, which can impact test runtimes significantly since we test 6 rotations in total (8 seconds).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know 1.2 seconds is a lot, but the timestamp format that is added to the log files when are rotated is vformat("%sT%02d:%02d:%02d", timestamp, dt.hour, dt.minute, dt.second);
which is up to seconds. So in order to get a new file name more than a second must pass between file rotations.
25ac8bc
to
241a920
Compare
Fixes godotengine#97066 `RBSet` were used on `RotatedFileLogger` because it guarantees that iterating it is done via `operator<`. This is important because `RotatedFileLogger` depends on this behavior to delete the oldest log file. On godotengine#61194 `HashSet` was added and all `RBSet` uses were replaced by `HashSet`. When that happened, the iteration in order is guaranteed to be the insertion order, wich made that `RotatedFileLogger` delete the newest log file. As a bonus, I added unit test for `RotatedFileLogger` and `CompositeLogger`.
241a920
to
be2caf1
Compare
Fixes #97066
RBSet
were used onRotatedFileLogger
because it guarantees that iterating it is done viaoperator<
. This is important becauseRotatedFileLogger
depends on this behavior to delete the oldest log file.On #61194
HashSet
was added and allRBSet
uses were replaced byHashSet
.When that happened, the iteration in order is guaranteed to be the insertion order, wich made that
RotatedFileLogger
delete the newest log file. As a bonus, I added unit test forRotatedFileLogger
andCompositeLogger
.