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

Getting issue after upgrading to Monolog 3

connect-javed001 opened this issue · comments

Monolog version 3

Recently we upgraded from monolog 2 to Monolog 3 after that we are getting below error:

WARN PHP Fatal error: Uncaught Error: Cannot modify readonly property Monolog\LogRecord::$message in app/Utils/Logging/LogDNAFormatter.php:20.

We cannot help much without knowing this code of this LogDNAFormatter.

but formatters are not expected to modify the message in the LogRecord itself as that would leak the formatted message to other handlers that might use a different formatting. that's why the property is read-only.

Yeah you should just return a formatted string or array or something instead of modifying the log record. You can use $record->toArray() to get a monolog-v2 style array out of it for BC.