Skip to content

Conversation

@eavanvalkenburg
Copy link
Member

Motivation and Context

Closes: #2242

Description

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

Copilot AI review requested due to automatic review settings November 21, 2025 10:40
@markwallace-microsoft markwallace-microsoft added documentation Improvements or additions to documentation python labels Nov 21, 2025
@markwallace-microsoft
Copy link
Member

markwallace-microsoft commented Nov 21, 2025

Python Test Coverage

Python Test Coverage Report •
FileStmtsMissCoverMissing
packages/core/agent_framework
   _logging.py9188%12
TOTAL15462235384% 

Python Unit Test Overview

Tests Skipped Failures Errors Time
2218 127 💤 0 ❌ 0 🔥 52.251s ⏱️

Copilot finished reviewing on behalf of eavanvalkenburg November 21, 2025 10:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes logging setup by moving the logging.basicConfig() call from module-level execution to a dedicated setup_logging() function, giving users explicit control over when logging is configured.

Key Changes:

  • Introduced setup_logging() function in agent_framework._logging to encapsulate logging configuration
  • Updated the observability sample to demonstrate the new logging setup pattern
  • Added documentation explaining the opinionated logging format and how to use setup_logging()

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
python/packages/core/agent_framework/_logging.py Moved logging.basicConfig() from module level into a new setup_logging() function and exported it via __all__
python/samples/getting_started/observability/setup_observability_with_parameters.py Added import and call to setup_logging() to demonstrate the new logging configuration pattern
python/samples/getting_started/observability/README.md Added documentation sections explaining the setup_logging() function and updated sample description to reference logging setup

setup_observability()
```

We also have an opinionated logging format, which you can setup using:
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
We also have an opinionated logging format, which you can setup using:
Agent Framework also has an opinionated logging format, which you can setup using:

> Using this method implicitly enables telemetry, so you do not need to set the `ENABLE_OTEL` environment variable. You can still set `ENABLE_SENSITIVE_DATA` to control whether sensitive data is included in the telemetry, or call the `setup_observability()` function with the `enable_sensitive_data` parameter set to `True`.
#### Logging
We have a built-in logging configuration that works well with telemetry. It sets the format to a standard format that includes timestamp, pathname, line number, and log level. You can use that by calling the `setup_logging()` function from the `agent_framework` module.
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
We have a built-in logging configuration that works well with telemetry. It sets the format to a standard format that includes timestamp, pathname, line number, and log level. You can use that by calling the `setup_logging()` function from the `agent_framework` module.
Agent Framework has a built-in logging configuration that works well with telemetry. It sets the format to a standard format that includes timestamp, pathname, line number, and log level. You can use that by calling the `setup_logging()` function from the `agent_framework` module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Importing agent_framework sets logging level

4 participants