Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
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

@clokep

Description

@clokep

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:

pyo3_log::init();

And we import the synapse rust code very early in the Synapse process:

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 rarelyS-MinorBlocks non-critical functionality, workarounds exist.T-DefectBugs, crashes, hangs, security vulnerabilities, or other reported issues.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions