When you format a logRecord with JsonFormater::format(), it calls:
NormalizeFormatter::format()
NormalizeFormatter::normalizeRecord()
As a result, we get a nicely formatted record, including any exception data, if present.
However, when we try to format an array of records using JsonFormater::formatBatch() :
JsonFormater::formatBatchJson()
JsonFormater::normalize()
We lose the exception data.
As I understand, formatBatch is a way to format array of records in an optimized way if possible, with the output being the same as formatting each record individually in a foreach.
If this is the case, it may be a bug, and this PR fixes it for me.
I don't know if this issue affects anything other than exception data, but it was this specific case that led me to discover the problem.
For more context, I was writing a custom Handler, where I call this->getFormatter()->formatBatch($records); in handleBatch().
Monolog version 3
Hello,
When you format a logRecord with JsonFormater::format(), it calls:
As a result, we get a nicely formatted record, including any exception data, if present.
However, when we try to format an array of records using JsonFormater::formatBatch() :
We lose the exception data.
As I understand, formatBatch is a way to format array of records in an optimized way if possible, with the output being the same as formatting each record individually in a foreach.
If this is the case, it may be a bug, and this PR fixes it for me. I don't know if this issue affects anything other than exception data, but it was this specific case that led me to discover the problem. For more context, I was writing a custom Handler, where I call
this->getFormatter()->formatBatch($records);
inhandleBatch()
.