-
Notifications
You must be signed in to change notification settings - Fork 2
Add opt-in debug logging configuration for Jupyter server #31
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
Open
hc2p
wants to merge
1
commit into
main
Choose a base branch
from
hannes/enhanced-logging
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+45
−3
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,11 @@ | |
| # do not import explicitly it will break the config loading | ||
| c = get_config() # pylint: disable=E0602; # noqa: F821 | ||
|
|
||
| # Environment variable-based debug logging configuration | ||
| # Set DEEPNOTE_ENABLE_DEBUG_LOGGING=true to enable verbose DEBUG logs | ||
| # Set DEEPNOTE_ENABLE_ZMQ_DEBUG=true to enable detailed ZMQ message logging | ||
| debug_logging_enabled = os.getenv("DEEPNOTE_ENABLE_DEBUG_LOGGING", "false").lower() == "true" | ||
| log_level = "DEBUG" if debug_logging_enabled else "INFO" | ||
|
|
||
| # ------------------------------------------------------------------------------ | ||
| # Application(SingletonConfigurable) configuration | ||
|
|
@@ -27,7 +32,8 @@ | |
| ## Set the log level by value or name. | ||
| # Choices: any of [0, 10, 20, 30, 40, 50, 'DEBUG', 'INFO', 'WARN', 'ERROR', 'CRITICAL'] | ||
| # Default: 30 | ||
| c.Application.log_level = 10 | ||
| # Conditional based on DEEPNOTE_ENABLE_DEBUG_LOGGING environment variable | ||
| c.Application.log_level = 10 if debug_logging_enabled else 20 # DEBUG or INFO | ||
|
|
||
| ## Configure additional log handlers. | ||
| # | ||
|
|
@@ -414,7 +420,15 @@ | |
|
|
||
| ## | ||
| # See also: Application.logging_config | ||
| # c.ServerApp.logging_config = {} | ||
| # Enhanced logging configuration for debugging | ||
| # Uses debug_logging_enabled and log_level variables defined at the top of this file | ||
| c.ServerApp.logging_config = { | ||
| "loggers": { | ||
| "tornado.access": {"level": log_level}, | ||
| "jupyter_server.serverapp": {"level": log_level}, | ||
| "jupyter_client.session": {"level": log_level}, | ||
| } | ||
| } | ||
|
|
||
| ## The login handler class to use. | ||
| # Default: 'notebook.auth.login.LoginHandler' | ||
|
|
@@ -820,7 +834,10 @@ | |
|
|
||
| ## Debug output in the Session | ||
| # Default: False | ||
| # c.Session.debug = False | ||
| # Enable ZMQ message flow debugging for troubleshooting kernel communication | ||
| # Set DEEPNOTE_ENABLE_ZMQ_DEBUG=true to enable detailed ZMQ message logging | ||
| if os.getenv("DEEPNOTE_ENABLE_ZMQ_DEBUG", "false").lower() == "true": | ||
| c.Session.debug = True | ||
|
Comment on lines
+837
to
+840
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Optional: Extract to variable for consistency. This works correctly, but for consistency with lines 16-17, consider extracting the environment check to a variable. # Debug output in the Session
# Default: False
-# Enable ZMQ message flow debugging for troubleshooting kernel communication
-# Set DEEPNOTE_ENABLE_ZMQ_DEBUG=true to enable detailed ZMQ message logging
-if os.getenv("DEEPNOTE_ENABLE_ZMQ_DEBUG", "false").lower() == "true":
- c.Session.debug = True
+# Enable ZMQ message flow debugging for troubleshooting kernel communication
+# Set DEEPNOTE_ENABLE_ZMQ_DEBUG=true to enable detailed ZMQ message logging
+zmq_debug_enabled = os.getenv("DEEPNOTE_ENABLE_ZMQ_DEBUG", "false").lower() == "true"
+if zmq_debug_enabled:
+ c.Session.debug = True
🤖 Prompt for AI Agents |
||
|
|
||
| ## The maximum number of digests to remember. | ||
| # | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistency: log_level variable defined as string but integers used here.
Line 17 defines
log_level = "DEBUG" if debug_logging_enabled else "INFO"(string), but this line uses integers directly. Either use the string variable consistently or define an integer variable.Apply this diff for consistency:
🤖 Prompt for AI Agents