mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 08:05:53 +03:00
[GH-ISSUE #642] How to save datetime field in ISODate format instead of seconds #232
Labels
No labels
Bug
Documentation
Feature
Needs Work
Support
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/monolog#232
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @laukaichung on GitHub (Sep 8, 2015).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/642
I have been using a php IDS system
exposethat uses monolog to store logs into MongoDB. I'm trying to change thedatetimefield to ISODate format so that I can use the MongoDB’s “time to live” or TTL collection feature to delete logs.Here's the part responsible for storing datetime in
\Expose\Log\Mongo();I have changed
$record['datetime'] = $record['datetime']->format('U');to$record['datetime'] = new \MongoDate();but the timestamp is stored as
instead of
How can I get the
datetimeto store in ISODate format instead of seconds?@Seldaek commented on GitHub (Sep 13, 2015):
You'd need to extend and override the JsonFormatter::normalize method and set a custom formatter on that MongoDBHandler I believe.