diff --git a/CHANGELOG.md b/CHANGELOG.md index e9fc96be..643358ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,8 @@ ([#241](https://github.com/microsoft/ApplicationInsights-Python/pull/241)) - Defaulting logging env var for auto-instrumentation. Added logging samples. ([#240](https://github.com/microsoft/ApplicationInsights-Python/pull/240)) +- Removed old log_diagnostic_error calls from configurator + ([#242](https://github.com/microsoft/ApplicationInsights-Python/pull/242)) ## [1.0.0b8](https://github.com/microsoft/ApplicationInsights-Python/releases/tag/v1.0.0b8) - 2022-09-26 diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/configurator.py b/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/configurator.py index 3593471c..cd83f70f 100644 --- a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/configurator.py +++ b/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/configurator.py @@ -5,23 +5,28 @@ # -------------------------------------------------------------------------- +import logging + from azure.monitor.opentelemetry.distro._diagnostics._diagnostic_logging import ( AzureDiagnosticLogging, ) from opentelemetry.sdk._configuration import _OTelSDKConfigurator +_logger = logging.getLogger(__name__) + class AzureMonitorConfigurator(_OTelSDKConfigurator): def _configure(self, **kwargs): try: + AzureDiagnosticLogging.enable(_logger) super()._configure(**kwargs) except ValueError as e: - AzureDiagnosticLogging.log_diagnostic_error( - f"The components failed to initialize due to a ValueError: {e}" + _logger.error( + f"Azure Monitor Configurator failed during configuration due to a ValueError: {e}" ) raise e except Exception as e: - AzureDiagnosticLogging.log_diagnostic_error( - f"The components failed to initialize: {e}" + _logger.error( + f"Azure Monitor Configurator failed during configuration: {e}" ) raise e