Skip to content

Commit 750d192

Browse files
authored
More diagnostic logging options (Azure#39701)
* More diagnostic logging * dep conflict log * changelog * debug
1 parent 725e673 commit 750d192

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

sdk/monitor/azure-monitor-opentelemetry/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### Features Added
66

7+
- Add more diagnostic log options
8+
([#39701](https://github.com/Azure/azure-sdk-for-python/pull/39701))
79
- Only add OpenTelemetry LoggingHandler if current logger does not have it
810
([#38549](https://github.com/Azure/azure-sdk-for-python/pull/38549))
911
- Distro to automatically configure event logger provider

sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_diagnostics/diagnostic_logging.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,23 @@
2424
_SUBSCRIPTION_ID = _SUBSCRIPTION_ID_ENV_VAR.split("+")[0] if _SUBSCRIPTION_ID_ENV_VAR else None
2525
_logger = logging.getLogger(__name__)
2626
_logger.propagate = False
27-
_logger.setLevel(logging.INFO)
27+
_logger.setLevel(logging.DEBUG)
2828
_DIAGNOSTIC_LOG_PATH = _get_log_path()
29+
2930
_DISTRO_DETECTS_ATTACH = "4100"
31+
_INFO = "4101"
32+
_INSTRUMENTATION_SKIPPED = "4101"
33+
3034
_ATTACH_SUCCESS_DISTRO = "4200"
3135
_ATTACH_SUCCESS_CONFIGURATOR = "4201"
36+
_INSTRUMENTATION_SUCCEEDED = "4202"
37+
38+
_DEPENDENCY_OVERLAP = "4300"
39+
3240
_ATTACH_FAILURE_DISTRO = "4400"
3341
_ATTACH_FAILURE_CONFIGURATOR = "4401"
3442
_ATTACH_DETECTS_SDK = "4402"
43+
_INSTRUMENTATION_FAILED = "4403"
3544

3645

3746
class AzureDiagnosticLogging:
@@ -69,6 +78,11 @@ def _initialize(cls):
6978
_logger.addHandler(f_handler)
7079
AzureDiagnosticLogging._initialized = True
7180

81+
@classmethod
82+
def debug(cls, message: str, message_id: str):
83+
AzureDiagnosticLogging._initialize()
84+
_logger.debug(message, extra={"msgId": message_id})
85+
7286
@classmethod
7387
def info(cls, message: str, message_id: str):
7488
AzureDiagnosticLogging._initialize()

0 commit comments

Comments
 (0)