Open
Description
Hi everyone, I'm getting duplicate logs with the exact timestamp in app insights, as the screenshot below shows:
The code I'm using:
import logging
from opencensus.ext.azure.log_exporter import AzureLogHandler
import sys
_logger = None
_logger = logging.getLogger('test')
if not _logger.handlers:
formatter = logging.Formatter('%(message)s')
azure_handler = AzureLogHandler(
connection_string="<my_key>")
azure_handler.setFormatter(formatter)
_logger.addHandler(azure_handler)
std_out_handler = logging.StreamHandler(sys.stdout)
std_out_handler.setLevel(logging.DEBUG)
_logger.addHandler(std_out_handler)
_logger.setLevel(logging.INFO)
_logger.propagate = False
_logger.root.propagate = False
properties = {'custom_dimensions': {'group': 'app_info'}}
_logger.info('test message', extra=properties)
I only get one message with the handler std_out_handler and when I sent message to the _logger the message is duplicated.
Any ideas how to solve / reason for this ?
Python version: 3.10
Opencensus version: 1.1.9
Thanks !