mirror of
https://github.com/Seldaek/monolog.git
synced 2026-04-26 08:05:53 +03:00
[GH-ISSUE #1495] JsonFormatter fails sometimes #631
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#631
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 @curtiscarlson on GitHub (Sep 2, 2020).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1495
Monolog version 1.24
Log fails to write if json_encode fails. This took a while to figure out. Log file will look like
I went on the console and manually
echo $e->getMessage();There is a SQLSTATE ERROR having to do with bad characters
if I manually
echo json_encode($e->getMessage());it outputs nothing.
This is using use Monolog\Formatter\JsonFormatter
I think it should be updated to store a log with a blank message, at least. The rest of the log could have been intact. This could be a check like
if(json_encode($e->getMessage()) === null) $message_body = "error encoding error message";or something to this effect....I did find that someone reported this in #616 and it was closed for being corrected, but I am getting this problem still.
The reason it is a problem is that when it just outputs null you dont know when it happened, what file, etc...
@Seldaek commented on GitHub (Dec 11, 2020):
Monolog 2 has much better handling for this, I'd recommend upgrading if you can.