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

Improve logging helper neo4j.debug.watch() #946

Merged
merged 3 commits into from
Jul 19, 2023

Conversation

robsdedude
Copy link
Member

The helper did not handle logging level correctly. For example

neo4j.debug.watch("neo4j", out=sys.stdout)
neo4j.debug.watch("neo4j", out=sys.stderr, level=logging.WARNING)

would've caused the logging level of the "neo4j" logger to end up being WARNING even though the first call (implicitly) requested DEBUG.

The fix will make sure to set the logger's level to the most verbose requested level and use a level filter on the Handlers registered for each call to filter on the level accordingly.

The helper did not handle logging level correctly. For example

```
neo4j.debug.watch("neo4j", out=sys.stdout)
neo4j.debug.watch("neo4j", out=sys.stderr, level=logging.WARNING)
```

would've caused the logging level of the "neo4j" logger to end up being
`WARNING` even though the first call (implicitly) requested `DEBUG`.

The fix will make sure to set the logger's level to the most verbose requested
level and use a level filter on the Handlers registered for each call to filter
on the level accordingly.
Copy link
Contributor

@bigmontz bigmontz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

@robsdedude robsdedude merged commit 4a975af into neo4j:5.0 Jul 19, 2023
@robsdedude robsdedude deleted the improve-logging-helper branch April 2, 2024 10:20
robsdedude added a commit to robsdedude/neo4j-python-driver that referenced this pull request Apr 2, 2024
The helper did not handle logging level correctly. For example

```
neo4j.debug.watch("neo4j", out=sys.stdout)
neo4j.debug.watch("neo4j", out=sys.stderr, level=logging.WARNING)
```

would've caused the logging level of the "neo4j" logger to end up being
`WARNING` even though the first call (implicitly) requested `DEBUG`.

The fix will make sure to set the logger's level to the most verbose requested
level and use a level filter on the Handlers registered for each call to filter
on the level accordingly.

Backport of neo4j#946
robsdedude added a commit that referenced this pull request Apr 12, 2024
The helper did not handle logging level correctly. For example

```
neo4j.debug.watch("neo4j", out=sys.stdout)
neo4j.debug.watch("neo4j", out=sys.stderr, level=logging.WARNING)
```

would've caused the logging level of the "neo4j" logger to end up being
`WARNING` even though the first call (implicitly) requested `DEBUG`.

The fix will make sure to set the logger's level to the most verbose requested
level and use a level filter on the Handlers registered for each call to filter
on the level accordingly.

Backport of #946
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