Skip to content
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

Adding message to specify that the snippet can also be used in auto-i… #1817

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ logger.addHandler(file)
logger.addHandler(stream)
...
```
> [!NOTE]
> In auto-instrumentation scenarios, this code snippet can also be added to your code to allow seeing internal logs of the [python auto-instrumentation agent](https://learn.microsoft.com/en-us/azure/azure-monitor/app/codeless-app-service?tabs=python).
Copy link
Contributor

@jeremydvoss jeremydvoss Mar 31, 2025

Choose a reason for hiding this comment

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

A couple issues with this. Thanks for reaching out. Firstly, logging.basicConfig does nothing if the root logger has already been configured which will almost always be the case in autoinstrumentation. So, the format specified would likely not be applied. Second, the code here only adds the file handler to the logger under name, i.e. the current file. So, if the current file is at the /foo/bar/init.py path, it would only capture logs created under the foo.bar.* namespace and not the namespace of our sdk, azure.monitor.opentelemetry.* . This applies for our manual sdk, too, not just autoinstrumentation.

Logs regarding autoinstrumentation can be seen at /var/log/applicationinsights/. See docs. However, if we want something more, we could discuss further.

Copy link
Contributor

Choose a reason for hiding this comment

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

logging.basicConfig would likely not work as intended even for manual instrumentation with the distro. I think this code likely came from the pre-distro, exporter-only era. We may want to redesign it.


### Test connectivity between your application host and the ingestion service

Expand Down