Logging configuration for Application Insights#1203
Conversation
|
The review app is available at this URL: |
2985fc3 to
98658ac
Compare
|
| # APPLICATIONINSIGHTS_CONNECTION_STRING environment variable. | ||
| configure_azure_monitor( | ||
| # Set the namespace for the logger in which you would like to collect telemetry for if you are collecting logging telemetry. This is imperative so you do not collect logging telemetry from the SDK itself. | ||
| logger_name=self.logger_name, |
There was a problem hiding this comment.
No longer specify logger_name in call to configure_azure_monitor. logger_name was a blocker for full log visibility
The logger_name parameter tells the SDK to attach its App Insights log handler only to the "insights-logger" logger. Every other logger is unaffected.
| "APPLICATIONINSIGHTS_LOGGER_NAME", "insights-logger" | ||
| ) | ||
| os.environ.setdefault("OTEL_SERVICE_NAME", self.logger_name) | ||
| os.environ.setdefault("OTEL_SERVICE_NAME", "manage-breast-screening") |
There was a problem hiding this comment.
Used more descriptive name, rather than insights-logger.
| @@ -305,29 +305,12 @@ def list_env(key): | |||
| "loggers": { | |||
There was a problem hiding this comment.
No longer specify "handlers": ["console"] and "propagate": False - instead let them propagate up and be handled by the root logger, which is configured to use "handlers": ["console"].
| "handlers": ["console"], | ||
| "level": "INFO", | ||
| "propagate": False, | ||
| "filters": ["suppress_duplicate_exceptions"], |
There was a problem hiding this comment.
Keeping "filters": ["suppress_duplicate_exceptions"] to avoid duplicate logging of 500 errors that will of been logged separately by ExceptionLoggingMiddleware



Description
Changes for logging to Application Insights, now I have access to Azure to check. This builds on top of what was already merged in #1153
To test I added these log lines to the show clinic page:
Then in Application Insights I could see them. Except the DEBUG message, as log level is INFO:
When I forced an error (by trying to check information of an appointment that had not been started) I could see the exception details in Application Insights. The Custom Properties included
userandcorrelation_id:Jira link
https://nhsd-jira.digital.nhs.uk/browse/DTOSS-12264