Skip to content

Add trace logging for the DNS server#17

Open
lizard-boy wants to merge 7 commits intomasterfrom
dns/trace-logging
Open

Add trace logging for the DNS server#17
lizard-boy wants to merge 7 commits intomasterfrom
dns/trace-logging

Conversation

@lizard-boy
Copy link
Copy Markdown

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
Copy Markdown

@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
Copy Markdown

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

return True


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

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