-
Notifications
You must be signed in to change notification settings - Fork 731
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
appender: add fallback to file creation date #3000
base: master
Are you sure you want to change the base?
Conversation
You may need to handle the prefix and suffix before parsing the date (a reverse function of tracing/tracing-appender/src/rolling.rs Lines 551 to 569 in c6bedbe
|
2723cf7
to
e683054
Compare
Oh, yeah, you're right. Thanks for the heads up, updated it now. Extracted the the datetime from the prefix/suffix, then converted to PrimitiveDateTime (because OffsetDateTime also takes a offset), then just assume it's utc (this is fine, because we also do this when writing AFAIK). |
The prefix or suffix can also contain a dot. |
e683054
to
3c23950
Compare
Damn, forgot about that. Should work now! |
3c23950
to
1cbad61
Compare
Third time's the charm :) |
|
What do you mean exactly, could you paste an example? If the logfile prefix given is not actually the prefix in the filename, we will get a wrong date string and the parsing will fail, but this is intended. |
I think you could have suffix |
Oof, right. I could reverse the suffix and the whole filename string and then search through? Like that I would always get the first substring from behind. AFAIK rust doesn't have a function to make it more convention ... |
Wouldn't |
When using the linux-musl target for rust, the file creation time cannot be retrieved, as the current version does not support it yet ( This will be fixed with [0]). In the meantime, we parse the datetime from the filename and use that as a fallback. Fixes: tokio-rs#2999 [0]: rust-lang/rust#125692
1cbad61
to
578fcc8
Compare
Hi! what's the status of this PR? Looks like it addressed all the review comments, is it getting blocked for some reason? We'd love to have this fix to avoid using a fork of |
@davidbarsky friendly ping :) |
When using the linux-musl target for rust, the file creation time cannot be retrieved, as the current version does not support it yet ( This will be fixed with 1). In the meantime, we parse the datetime from the filename and use that as a fallback.
Fixes: #2999
Footnotes
https://github.com/rust-lang/rust/pull/125692 ↩