Skip to content

[4.4] Improve logging helper neo4j.debug.watch() #1032

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

Merged
merged 3 commits into from
Apr 12, 2024

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.

Backport of #946

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 robsdedude changed the title Improve logging helper neo4j.debug.watch() [4.4] Improve logging helper neo4j.debug.watch() Apr 2, 2024
Copy link
Contributor

@AndyHeap-NeoTech AndyHeap-NeoTech left a comment

Choose a reason for hiding this comment

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

LGTM

@robsdedude robsdedude enabled auto-merge (squash) April 11, 2024 13:48
@robsdedude robsdedude disabled auto-merge April 12, 2024 07:48
@robsdedude robsdedude merged commit 16e346d into neo4j:4.4 Apr 12, 2024
12 checks passed
@robsdedude robsdedude deleted the improve-logging-helper-4.4 branch April 12, 2024 07:48
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