Commit 6a71720
committed
Use LogRecord.getMessage to get OLTP body
This improves compatibility with logging libraries that use
`logging.setLogRecordFactory()` or patching to customize the message
formatting of the created `LogRecord`s. It does this by using the
processed `LogRecord`'s `getMessage()` method to get the body text
instead of using `record.msg % record.args`.
Also adds "getMessage" to the list of reserved attributes so if the
customization is done by patching the `getMessage` function on the
`LogRecord` directly (instead of using a subclass), it's not
accidentally treated as an attribute.1 parent 189fa15 commit 6a71720
File tree
1 file changed
+2
-4
lines changed- opentelemetry-sdk/src/opentelemetry/sdk/_logs/_internal
1 file changed
+2
-4
lines changedLines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
438 | 438 | | |
439 | 439 | | |
440 | 440 | | |
| 441 | + | |
441 | 442 | | |
442 | 443 | | |
443 | 444 | | |
| |||
547 | 548 | | |
548 | 549 | | |
549 | 550 | | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
| 551 | + | |
554 | 552 | | |
555 | 553 | | |
556 | 554 | | |
| |||
0 commit comments