Open yli02 opened 1 month ago
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @gracewilcox @gulopesd @Haiying-MSFT @jairmyree @joshfree @KarishmaGhiya @KevinBlasko @kurtzeborn @nisha-bhatia @pvaneck @sarangan12 @scottaddie @srnagar @ToddKingMSFT.
@yli02
This scenario makes sense. A solution via environment variable in upstream OpenTelemetry Python would be able to enable this scenario and allow you to configure log level of the OpenTelemetry LoggingHandler
. This however has not been implemented yet.
As a side note, you must also change your code to pass in the namespace of the parent logger you want to use, not the variable name of the logger.
...
app_logger = logging.getLogger("App")
configure_azure_monitor(connection_string="", logger_name="App")
...
Is your feature request related to a problem? Please describe. The current logging configuration in [1] does not support to set the logging level for handler in [2], and this prevents to separate the logging to Azure and local in different levels based on logger hierarchy. For example
In the application, we would like to always use logger "app_logger_local" for different level of loggings to
stdout
andstderr
, and relying on logging hierarchy to pass logs to "app_logger". And we only would like to use Azure AppInsights to collect log with levelERROR
or higher.But this design is so far not feasible, as there is no checking of parent logger level at [3], see also [4].
Describe the solution you'd like It would be great if a new argument could be added to [1], like
logging_level
to setup the logging level of the handler in [2], so we could rely on the above example code to collect loggings in different levels at different destination.Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context [1] https://github.com/Azure/azure-sdk-for-python/blob/0673cc06817d998867676524cccf1eacb48a3e6c/sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py#L68
[2] https://github.com/Azure/azure-sdk-for-python/blob/0673cc06817d998867676524cccf1eacb48a3e6c/sdk/monitor/azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py#L163
[3] https://github.com/python/cpython/blob/15d48aea02099ffc5bdc5511cc53ced460cb31b9/Lib/logging/__init__.py#L1715
[4] https://github.com/python/cpython/issues/75045#issuecomment-1093753130