This repository was archived by the owner on Apr 26, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Logging in Rust code not working (in unit tests?) #14975
Copy link
Copy link
Closed
Labels
O-OccasionalAffects or can be seen by some users regularly or most users rarelyAffects or can be seen by some users regularly or most users rarelyS-MinorBlocks non-critical functionality, workarounds exist.Blocks non-critical functionality, workarounds exist.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Description
We use pyo3-log to get Rust logs into the Python logging framework; this seems to not work properly. If you put e.g. a warn!(...)
then it doesn't print out anywhere.
We initialize the logging module in lib.rs
:
Line 23 in 42d261c
pyo3_log::init(); |
And we import the synapse rust code very early in the Synapse process:
Line 83 in dc37b68
check_rust_lib_up_to_date() |
I think we're importing the rust code before the loggers are configured, which then causes pyo3-log
to initialize and cache the Python logging configuration, then by the time we actually call Rust code we've reconfigured the python loggers, but that doesn't propagate into Rust.
I ran into this in unittests, but I think it would happen during normal usage as well.
Metadata
Metadata
Assignees
Labels
O-OccasionalAffects or can be seen by some users regularly or most users rarelyAffects or can be seen by some users regularly or most users rarelyS-MinorBlocks non-critical functionality, workarounds exist.Blocks non-critical functionality, workarounds exist.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.Bugs, crashes, hangs, security vulnerabilities, or other reported issues.