Skip to content

Conversation

@ChristophWurst
Copy link
Member

According to PSR-3 the log message can have placeholders that are
replaced from the context object. Our logger implementation did that for
all PSR-3 logger methods. The only exception was our custom logException.

Since PsrLoggerAdapter calls logException when an exception key is
present in the context object, log messages were no longer interpolated.

Tested with the following snippet

		try {
			throw new \InvalidArgumentException('henlo');
		} catch (\Throwable $e) {
			$logger->debug('oh {no}', [
				'no' => 'no',
				'exception' => $e,
			]);
		}

On master I get oh {no} in my log. With this patch it's oh no.

According to PSR-3 the log message can have placeholders that are
replaced from the context object. Our logger implementation did that for
all PSR-3 logger methods. The only exception was our custom `logException`.

Since PsrLoggerAdapter calls logException when an exception key is
present in the context object, log messages were no longer interpolated.

Signed-off-by: Christoph Wurst <[email protected]>
@ChristophWurst ChristophWurst added bug 3. to review Waiting for reviews labels Nov 29, 2021
@ChristophWurst ChristophWurst added this to the Nextcloud 24 milestone Nov 29, 2021
@ChristophWurst ChristophWurst self-assigned this Nov 29, 2021
@ChristophWurst ChristophWurst requested review from ArtificialOwl and icewind1991 and removed request for a team November 29, 2021 13:33
@ChristophWurst
Copy link
Member Author

/backport to stable23

@ChristophWurst
Copy link
Member Author

/backport to stable22

@ChristophWurst
Copy link
Member Author

/backport to stable21

Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me also with backports, but 20 is EOL

@ChristophWurst
Copy link
Member Author

20 is EOL

TIL!

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

Labels

3. to review Waiting for reviews bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants