Skip to content
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

Wrong format of timestamp #41

Closed
3 of 11 tasks
VadimIzmalkov opened this issue May 17, 2018 · 2 comments
Closed
3 of 11 tasks

Wrong format of timestamp #41

VadimIzmalkov opened this issue May 17, 2018 · 2 comments

Comments

@VadimIzmalkov
Copy link

VadimIzmalkov commented May 17, 2018

What ZF application I'm using when issue happen ?

  • ^ZF2.5
  • ^ZF3
  • Expressive 1
  • Expressive 2
  • Expressive 3

What PHP version you're using?

  • PHP 5.6
  • PHP 7.0
  • PHP 7.1
  • PHP 7.2

What ErrorHeroModule version you're using?

  • ^1.0
  • ^2.0

Expected behavior

Write logs to database.

Actual behavior

Nothing happens in database once bug has been occured.

Explanation

Method $this->getDateTimeFormat() https://github.com/samsonasik/ErrorHeroModule/blob/master/src/Handler/Formatter/Json.php#L26 return timestamp in "c" format 2004-02-12T15:19:21+00:00 . On my preset Mysql requires "Y-m-d H:i:s"

Workaround

Change type of 'date' to text

@samsonasik
Copy link
Owner

samsonasik commented May 17, 2018

In that case, you can setup your log config to set "formatter"'s dateTimeFormat with the following under "options" in db writers config:

// config/autoload/error-hero-module.local.php
    'log' => [
        'ErrorHeroModuleLogger' => [
            'writers' => [

                [
                    'name' => 'db',
                    'options' => [
                        // ... current config
                        'formatter' => [
                             'name' => 'db',
                             'options' => [
                                  'dateTimeFormat' => 'Y-m-d H:i:s',
                             ],
                         ],
                      // ...
                    ],
                ],

            ],
        ],
    ],

@VadimIzmalkov
Copy link
Author

VadimIzmalkov commented May 18, 2018

Thanks, it works for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants