Superskyyy edited a comment on issue #8699:
URL: https://github.com/apache/skywalking/issues/8699#issuecomment-1072929993
Thanks @wzy960520 for the pull request! But on second thought, the solution
provided in the PR look a bit off to me.
To my understanding, the problem occurs due to the existence of a cached
`exc_text` attribute contained inside the `LogRecord` object which `.format()`
set during the interception.
The following is from the Python logging module, as we can see the cache is
done by this chunk of code. The bug occurs because SkyWalking agent did not
clear the cache after doing the formatting, therefore, other formatters would
just reuse the cached exception, essentially bypassing the arguments.
```
if record.exc_info:
# Cache the traceback text to avoid converting it multiple times
# (it's constant anyway)
if not record.exc_text:
record.exc_text = self.formatException(record.exc_info)
```
Now, if we simply switch the lines around by executing the user's handler
first and then format by SkyWalking agent, it seems to me that it would cause
the same issue (but reversed - UI shows whatever exception format that user
handler.formatter uses). Instead, we could just reset the LogRecord.exc_text to
None as the doc suggests.
I will send another PR to address the issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]