-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Set date format in Logger #1459
Comments
Indeed JsonFormatter relies on jsonSerialize's implementation on I think fixing it to allow choosing a date format sounds possible and reasonable, but I am not sure about adding a default global date format option, that sounds like it's going to be a mess to handle. |
Thanks for the consideration! You're right about the global format, that's a broad request. |
If you feel like sending a PR for adding this to JsonFormatter please do :) |
I'm also stuck on the exact same problem. @delrio-design Can you please explain a bit more how you solved it. |
Some background: I am using Fluent Bit as a log forwarder for a containerized PHP application with Monolog, and want to standardize date formats across my log streams.
Some formatters, such as LineFormatter and NormalizeFormatter allow this already. I am using JsonFormatter for structured logs, it inherits from NormalizeFormatter, but I don't believe I can set the date format without subclassing it and overriding the normalize method myself. I would like to be able to set the date format globally or consistently per formatter. Given that some streams require certain date formats for ingestion by third party services, it would be nice if each step from logger to handler to stream inherited the default or global date format unless explicitly set.
The text was updated successfully, but these errors were encountered: