Skip to content

Add trace logging for the DNS server #17

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
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

lizard-boy
Copy link

Motivation

Building on localstack#10808, we want to enable debug logging for the DNS server.

Changes

  • Set default DNS logging level to INFO in debug mode, so DEBUG=1 does not enable this debug logging
  • Add debug logging for DNS which can be enabled with the configuration LOGGING_OVERRIDE=localstack.dns=DEBUG

Requires localstack#10808

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR enhances DNS server logging in LocalStack and introduces a new configuration option for custom logging overrides.

  • Added LOGGING_OVERRIDE configuration for fine-grained control of logger levels
  • Implemented parse_key_value_pairs function in localstack/utils/collections.py for parsing environment variable-like strings
  • Set default DNS logging level to INFO in debug mode
  • Added debug logging statements in localstack/dns/server.py for detailed DNS query information
  • Included unit tests for the new parse_key_value_pairs function in tests/unit/utils/test_collections.py

5 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings

Comment on lines +96 to +99
except Exception as e:
raise RuntimeError(
f"Failed to configure logging overrides ({raw_logging_override})"
) from e
Copy link

Choose a reason for hiding this comment

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

style: Consider logging the exception details for easier debugging

@@ -533,3 +533,24 @@ def is_comma_delimited_list(string: str, item_regex: Optional[str] = None) -> bo
if pattern.match(string) is None:
return False
return True


def parse_key_value_pairs(raw_text: str) -> dict:
Copy link

Choose a reason for hiding this comment

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

style: Consider adding type hints to the function signature for better code readability and IDE support

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