Summary
User is attempting to enable debug level logging in a Python connector using OpenTelemetry but is facing issues as the debug logs are not appearing despite setting the logger level to DEBUG.
Question
hey gents!
i’m trying to enable logger.debug level in my Python connector + add OTEL handler
and if with OTEL handler i did not have any problems, then debug level is something hard
p.s. even --debug
arg in entry point did not help me
my code is:
import logging
from opentelemetry._logs import set_logger_provider
from opentelemetry.exporter.otlp.proto.http._log_exporter import (OTLPLogExporter)
from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler
from opentelemetry.sdk._logs.export import BatchLogRecordProcessor
logger_provider = LoggerProvider()
set_logger_provider(logger_provider)
exporter = OTLPLogExporter()
logger_provider.add_log_record_processor(BatchLogRecordProcessor(exporter))
handler = LoggingHandler(level=logging.NOTSET, logger_provider=logger_provider)
logging.getLogger("airbyte").setLevel(logging.DEBUG)
logger = logging.getLogger("airbyte").addHandler(handler)
...
logger.debug('debug')
logger.info('info')
logger.warning('warning')
logger.error('error')
logger.critical('critical')
...```
my airbyte output is:
```...
2024-11-28 15:12:23 source > info
2024-11-28 15:12:23 source > warning
2024-11-28 15:12:23 source > error
2024-11-28 15:12:23 source > critical
...```
<br>
---
This topic has been created from a Slack thread to give it more visibility.
It will be on Read-Only mode here. [Click here](https://airbytehq.slack.com/archives/C027KKE4BCZ/p1732807091192079) if you want
to access the original thread.
[Join the conversation on Slack](https://slack.airbyte.com)
<sub>
['python-connector', 'logging', 'opentelemetry', 'debug-level']
</sub>