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

Getting issue after upgrading to Monolog 3 #1814

Open
connect-javed001 opened this issue Jun 18, 2023 · 2 comments
Open

Getting issue after upgrading to Monolog 3 #1814

connect-javed001 opened this issue Jun 18, 2023 · 2 comments
Labels

Comments

@connect-javed001
Copy link

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.

@stof
Copy link
Contributor

stof commented Jun 19, 2023

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.

@Seldaek
Copy link
Owner

Seldaek commented Jun 20, 2023

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.

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

No branches or pull requests

3 participants