How to write Custom log before application start Azure

%3CLINGO-SUB%20id%3D%22lingo-sub-1504996%22%20slang%3D%22en-US%22%3EHow%20to%20write%20Custom%20log%20before%20application%20start%20Azure%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1504996%22%20slang%3D%22en-US%22%3E%3CP%20class%3D%22%22%3EHi%20%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIssue%20%3A%20-%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20my%20code%26nbsp%3B%3CSTRONG%3E%3CEM%3E%26nbsp%3B%26nbsp%3B.Connect(new%20Uri(appConfigEndpoint)%2C%20credentials)%26nbsp%3B%3C%2FEM%3E%3C%2FSTRONG%3E%26nbsp%3Bline%20is%20trowing%20exception%20and%20in%20azure%26nbsp%3B%20log%20stream%20its%20saying%20bad%20gate%26nbsp%3B%20502.2%20way%20because%20its%20not%20able%20to%20connect%20with%20appconfig%20end%20point%20.%20I%20want%20to%20display%20a%20custom%20message%20like%26nbsp%3B%3C%2FP%3E%3CP%3E%22Not%20able%20to%20connect%20to%20Appconfig%20end%20point%22%20in%20azure%20app%20live%20log%20stream%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20Log.WriteLog(context.HostingEnvironment%2C%20%22Adding%20Application%20Configuration%22)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20LogWriter.LogInformation(1%2C%20%22Adding%20Application%20Configuration%22)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20var%20appConfigEndpoint%20%3D%20GetAppConfigEndpoint()%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20var%20credentials%20%3D%20new%20ManagedIdentityCredential()%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20var%20pollingInterval%20%3D%2030%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20int.TryParse(GetPollingInterval()%2C%20out%20pollingInterval)%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%2F%2F%20Adding%20App%20Config%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20config.AddAzureAppConfiguration(options%20%3D%26gt%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%3CSTRONG%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3Eoptions%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%3CSTRONG%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%3CEM%3E%3CSPAN%3E%26nbsp%3B%3C%2FSPAN%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B.Connect(new%20Uri(appConfigEndpoint)%2C%20credentials)%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Hi ,

 

Issue : - 

 

In my code   .Connect(new Uri(appConfigEndpoint), credentials)  line is trowing exception and in azure  log stream its saying bad gate way 502.2 because its not able to connect with appconfig end point . I want to display a custom message like 

"Not able to connect to Appconfig end point" in azure app live log stream

 

  Log.WriteLog(context.HostingEnvironment, "Adding Application Configuration");

                            LogWriter.LogInformation(1, "Adding Application Configuration");

                            var appConfigEndpoint = GetAppConfigEndpoint();

                            var credentials = new ManagedIdentityCredential();

                            var pollingInterval = 30;

                            int.TryParse(GetPollingInterval(), out pollingInterval);

                            // Adding App Config

                            config.AddAzureAppConfiguration(options =>

                            options

                                 .Connect(new Uri(appConfigEndpoint), credentials)

0 Replies