Seldaek / monolog

Sends your logs to files, sockets, inboxes, databases and various web services

Home Page:https://seldaek.github.io/monolog/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

why datetime is UTC?

kukudeliu opened this issue · comments

`

$logger = new Logger('TEST');
    $logger->setTimezone(new \DateTimeZone('Asia/Shanghai'));
    $client  = new MongoDB\Client('mongodb://127.0.0.1/');
    $handler = new MongoDBHandler($client, 'logs', 'prod');
    $logger->pushHandler($handler);
    $logger->info('666', [1213213]);
    echo 'success';`

image

2023-06-07 10:15:23.555 is right

As per the information provided in the MongoDB documentation (source: https://www.mongodb.com/docs/v4.4/tutorial/model-time-data/#:~:text=Time%2DSeries%20Data-,Overview,time%20representations%20into%20this%20form), timestamps are stored in UTC by default.

Yup, it's just the way MongoDB stores it, probably you can format it in your desired timezone on display?