Skip to content

Commit

Permalink
Added logs on toolsservice for debugging. (#2418)
Browse files Browse the repository at this point in the history
* Revert "Path fix for macos (#2413)"

This reverts commit fb1bee4.

* path issue fix

* added logs

---------

Co-authored-by: ROSHAN SAHU <[email protected]>
  • Loading branch information
sahuroshan and ROSHAN SAHU authored Oct 21, 2024
1 parent 4c974b0 commit 2d1c29e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Microsoft.SqlTools.Migration/MigrationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -611,11 +611,15 @@ internal async Task HandleGetArmTemplateRequest(
{
try
{
Logger.Verbose("request received in toolsservice");
ProvisioningScriptServiceProvider provider = new ProvisioningScriptServiceProvider();
string searchPattern = $"*{targetType}-Baseline*.json";
string skuRecommendationReportFilePath = Directory.GetFiles(SqlAssessmentConfiguration.ReportsAndLogsRootFolderPath, searchPattern).FirstOrDefault();
Logger.Verbose($"Logging report file path -- {skuRecommendationReportFilePath}");
List<SkuRecommendationResult> recommendations = ExtractSkuRecommendationReportAction.ExtractSkuRecommendationsFromReport(skuRecommendationReportFilePath);
Logger.Verbose($"recommendations generated-- {recommendations.Count}");
List<SqlArmTemplate> templateList = provider.GenerateProvisioningScript(recommendations);
Logger.Verbose($"ARM templates generated-- {templateList.Count}");
List<string> armTemplates = new List<string>();
foreach (SqlArmTemplate template in templateList)
{
Expand All @@ -624,13 +628,17 @@ internal async Task HandleGetArmTemplateRequest(
Formatting.Indented,
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore, Culture = CultureInfo.InvariantCulture }
);
Logger.Verbose($"Logging ARM templates -- {jsonOutput}");
armTemplates.Add(jsonOutput);
}
Logger.Verbose($"sending response -- {armTemplates.Count}");
await requestContext.SendResult(armTemplates);
}
catch (Exception e)
{
await requestContext.SendError(e.ToString());
Logger.Verbose($"inside catch block -- ");
await requestContext.SendError(e.ToString());
}
}

Expand Down

0 comments on commit 2d1c29e

Please sign in to comment.