Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid logging.basicConfig in non-scripts #541

Merged
merged 1 commit into from
Jul 5, 2022

Conversation

ajprax
Copy link
Contributor

@ajprax ajprax commented Jun 6, 2022

matterport_objects.py calls logging.basicConfig(). basicConfig is intended for quickly setting up logging in scripts, not for library code. matterport_objects is imported by import open3d and sets the root log level and format which interferes with logging in the importing code. matterport_objects only logs once on initialization and doesn't seem like it should be opinionated about whether that log shows or how it's formatted.

As an example, Bottle's run(..., quiet=True) assumes that the root logger's log level stays at the default WARNING and import open3d sets it to INFO via matterport_objects which adds a lot of log noise.


This change is Reviewable

[matterport_objects.py](https://github.com/isl-org/Open3D-ML/blob/13c847b50f4766cd73f942bd2c12bb86c202c088/ml3d/datasets/matterport_objects.py) calls `logging.basicConfig()`. `basicConfig` is intended for quickly setting up logging in scripts, not for library code. `matterport_objects` is imported by `import open3d` and sets the root log level and format which interferes with logging in the importing code. `matterport_objects` only logs once on initialization and doesn't seem like it should be opinionated about whether that log shows or how it's formatted.

As an example, Bottle's `run(..., quiet=True)` assumes that the root logger's log level stays at the default `WARNING` and `import open3d` sets it to `INFO` via `matterport_objects` which adds a lot of log noise.
@ssheorey ssheorey requested a review from sanskar107 June 17, 2022 03:02
@sanskar107 sanskar107 merged commit 7cce0e6 into isl-org:master Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants