Closed Bug 1600946 Opened 5 years ago Closed 5 years ago

Python bindings: Control logging the Rust from the Python logging API

Categories

(Data Platform and Tools :: Glean: SDK, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: mdroettboom, Unassigned)

Details

(Whiteboard: [telemetry:glean-rs:m13][glean-py])

Attachments

(1 file)

There is an FFI API glean_enable_logging to control logging from the Rust code. We should make this available through the Python logging API so it feels "Pythonic".

Whiteboard: [telemetry:glean-rs:m?] → [telemetry:glean-rs:m?][glean-py]

Hey Mike,

what's the current behaviour? Do we get any logging from Rust when using Python bindings?

Flags: needinfo?(mdroettboom)

The current behavior (as of commit c3f5a16ded1711a552576fcb1cbc50cb8c67be73) is to always display all log message from Rust.

The purpose of this bug would be to make it controllable from Python using the standard APIs that a Python programmer would expect.

Flags: needinfo?(mdroettboom)

(In reply to Michael Droettboom [:mdroettboom] from comment #2)

The current behavior (as of commit c3f5a16ded1711a552576fcb1cbc50cb8c67be73) is to always display all log message from Rust.

It still requires to set the RUST_LOG variable!

Whiteboard: [telemetry:glean-rs:m?][glean-py] → [telemetry:glean-rs:m13][glean-py]

I haven't been able to get to the bottom of why, but something is turning the logging on during Python unit testing (which is probably ok, actually, but surprising). I can't reproduce it directly outside of unit testing.

$ PYTEST_ARGS=-s make test-python
=============================================================================================== test session starts ===============================================================================================
platform linux -- Python 3.7.0, pytest-4.3.0, py-1.8.0, pluggy-0.13.1 
rootdir: /home/mdboom/Work/builds/glean/glean.rs/glean-core/python, inifile:
plugins: localserver-0.5.0                                                                               
collected 64 items                                                                                                                                                                                                
                                                                                                                                                                                                                   
glean-core/python/tests/test_dispatcher.py ...                                                                                                                                                                     
glean-core/python/tests/test_glean.py .......s...s.[2020-01-02T20:26:07Z ERROR glean_core] Duplicate ping named 'store1'
.[2020-01-02T20:26:07Z ERROR glean_core] Duplicate ping named 'store1'
[2020-01-02T20:26:07Z ERROR glean_core] Duplicate ping named 'store1'
.[2020-01-02T20:26:07Z ERROR glean_core] Duplicate ping named 'store1'
.sss[2020-01-02T20:26:07Z ERROR glean_core] Duplicate ping named 'store1'
.[2020-01-02T20:26:08Z ERROR glean_core] Duplicate ping named 'store1'
.[2020-01-02T20:26:08Z ERROR glean_core] Duplicate ping named 'store1'
[2020-01-02T20:26:08Z ERROR glean_core] Duplicate ping named 'store1'
.[2020-01-02T20:26:08Z ERROR glean_core] Duplicate ping named 'store1'
[2020-01-02T20:26:08Z ERROR glean_core] Duplicate ping named 'store1'
.[2020-01-02T20:26:08Z ERROR glean_core] Duplicate ping named 'store1'
[2020-01-02T20:26:08Z ERROR glean_core] Duplicate ping named 'store1'
[2020-01-02T20:26:08Z ERROR glean_core] Duplicate ping named 'store1'
[2020-01-02T20:26:08Z ERROR glean_core] Duplicate ping named 'store1'
.[2020-01-02T20:26:08Z ERROR glean_core] Duplicate ping named 'store1'
[2020-01-02T20:26:08Z ERROR glean_core] Duplicate ping named 'store1'
.
glean-core/python/tests/test_loader.py [2020-01-02T20:26:09Z ERROR glean_core] Duplicate ping named 'store1'
[2020-01-02T20:26:09Z ERROR glean_core] Duplicate ping named 'store1'
.[2020-01-02T20:26:09Z ERROR glean_core] Duplicate ping named 'store1'
[2020-01-02T20:26:09Z ERROR glean_core] Duplicate ping named 'store1'

I think the log level error is enabled by default? Let me test.

Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: