diff --git a/infra/main.bicep b/infra/main.bicep index 81bad2a4..c6f0f23f 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -1265,14 +1265,18 @@ module avmAppConfig 'br/public:avm/res/app-configuration/configuration-store:0.9 name: 'APP_CPS_PROCESSES' value: 'cps-processes' } - { - name: 'APP_LOGGING_ENABLE' - value: 'False' - } { name: 'APP_LOGGING_LEVEL' value: 'INFO' } + { + name: 'AZURE_PACKAGE_LOGGING_LEVEL' + value: 'WARNING' + } + { + name: 'AZURE_LOGGING_PACKAGES' + value: '' + } { name: 'APP_MESSAGE_QUEUE_EXTRACT' value: 'content-pipeline-extract-queue' diff --git a/infra/main.json b/infra/main.json index 20cd7108..70291159 100644 --- a/infra/main.json +++ b/infra/main.json @@ -5,8 +5,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.38.33.27573", - "templateHash": "16555018991316490501" + "version": "0.37.4.10188", + "templateHash": "17737076781026161010" }, "name": "Content Processing Solution Accelerator", "description": "Bicep template to deploy the Content Processing Solution Accelerator with AVM compliance." @@ -301,7 +301,7 @@ "virtualNetwork": { "condition": "[parameters('enablePrivateNetworking')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('module.virtual-network.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -338,8 +338,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.38.33.27573", - "templateHash": "18421381145511279077" + "version": "0.37.4.10188", + "templateHash": "11467005478013673408" } }, "definitions": { @@ -782,7 +782,7 @@ }, "condition": "[not(empty(tryGet(parameters('subnets')[copyIndex()], 'networkSecurityGroup')))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.network.network-security-group.{0}.{1}', tryGet(parameters('subnets')[copyIndex()], 'networkSecurityGroup', 'name'), parameters('resourceSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -1444,7 +1444,7 @@ }, "virtualNetwork": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.network.virtual-network.{0}', parameters('name')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -3184,7 +3184,7 @@ "bastionHost": { "condition": "[parameters('enablePrivateNetworking')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.network.bastion-host.{0}', variables('bastionHostName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -4890,7 +4890,7 @@ "jumpboxVM": { "condition": "[parameters('enablePrivateNetworking')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.compute.virtual-machine.{0}', variables('jumpboxVmName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -13813,7 +13813,7 @@ "maintenanceConfiguration": { "condition": "[parameters('enablePrivateNetworking')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.maintenance-configuration.{0}', variables('jumpboxVmName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -14236,7 +14236,7 @@ "windowsVmDataCollectionRules": { "condition": "[and(parameters('enablePrivateNetworking'), parameters('enableMonitoring'))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.insights.data-collection-rule.{0}', variables('dataCollectionRulesResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -15433,7 +15433,7 @@ "proximityPlacementGroup": { "condition": "[parameters('enablePrivateNetworking')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.compute.proximity-placement-group.{0}', variables('proximityPlacementGroupResourceName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -15803,7 +15803,7 @@ }, "condition": "[parameters('enablePrivateNetworking')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.network.private-dns-zone.{0}', split(variables('privateDnsZones')[copyIndex()], '.')[1]), 64)]", "properties": { "expressionEvaluationOptions": { @@ -19175,7 +19175,7 @@ "logAnalyticsWorkspace": { "condition": "[parameters('enableMonitoring')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('module.log-analytics-workspace.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -19215,8 +19215,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.38.33.27573", - "templateHash": "560390455976704184" + "version": "0.37.4.10188", + "templateHash": "12301807179615268820" } }, "parameters": { @@ -19301,7 +19301,7 @@ "logAnalyticsWorkspace": { "condition": "[not(variables('useExistingWorkspace'))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.operational-insights.workspace.{0}', parameters('name')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -22416,7 +22416,7 @@ }, "primarySharedKey": { "type": "securestring", - "value": "[if(variables('useExistingWorkspace'), if(variables('useExistingWorkspace'), listKeys(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', variables('existingLawSubscription'), variables('existingLawResourceGroup')), 'Microsoft.OperationalInsights/workspaces', variables('existingLawName')), '2020-08-01'), listOutputsWithSecureValues('logAnalyticsWorkspace', '2025-04-01').primarySharedKey).primarySharedKey, listOutputsWithSecureValues('logAnalyticsWorkspace', '2025-04-01').primarySharedKey)]" + "value": "[if(variables('useExistingWorkspace'), if(variables('useExistingWorkspace'), listKeys(extensionResourceId(format('/subscriptions/{0}/resourceGroups/{1}', variables('existingLawSubscription'), variables('existingLawResourceGroup')), 'Microsoft.OperationalInsights/workspaces', variables('existingLawName')), '2020-08-01'), listOutputsWithSecureValues('logAnalyticsWorkspace', '2022-09-01').primarySharedKey).primarySharedKey, listOutputsWithSecureValues('logAnalyticsWorkspace', '2022-09-01').primarySharedKey)]" }, "location": { "type": "string", @@ -22433,7 +22433,7 @@ "applicationInsights": { "condition": "[parameters('enableMonitoring')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.insights.component.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -23194,7 +23194,7 @@ }, "avmManagedIdentity": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('module.managed-identity.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -23221,8 +23221,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.38.33.27573", - "templateHash": "2793197383642316382" + "version": "0.37.4.10188", + "templateHash": "13740105132808447867" } }, "parameters": { @@ -23254,7 +23254,7 @@ "resources": [ { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[parameters('name')]", "properties": { "expressionEvaluationOptions": { @@ -23748,11 +23748,11 @@ "outputs": { "resourceId": { "type": "string", - "value": "[reference(resourceId('Microsoft.Resources/deployments', parameters('name')), '2025-04-01').outputs.resourceId.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', parameters('name')), '2022-09-01').outputs.resourceId.value]" }, "principalId": { "type": "string", - "value": "[reference(resourceId('Microsoft.Resources/deployments', parameters('name')), '2025-04-01').outputs.principalId.value]" + "value": "[reference(resourceId('Microsoft.Resources/deployments', parameters('name')), '2022-09-01').outputs.principalId.value]" } } } @@ -23760,7 +23760,7 @@ }, "avmContainerRegistry": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('module.container-registry.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -23813,8 +23813,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.38.33.27573", - "templateHash": "14317636974851330304" + "version": "0.37.4.10188", + "templateHash": "1625816523209796564" }, "name": "Container Registry Module" }, @@ -23989,7 +23989,7 @@ "resources": { "avmContainerRegistry": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[parameters('acrName')]", "properties": { "expressionEvaluationOptions": { @@ -27193,7 +27193,7 @@ }, "avmStorageAccount": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('module.storage-account.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -35173,7 +35173,7 @@ }, "avmAiServices": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('module.ai-services.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -35273,8 +35273,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.38.33.27573", - "templateHash": "4858050929017360206" + "version": "0.37.4.10188", + "templateHash": "11274582451224711300" }, "name": "Cognitive Services", "description": "This module deploys a Cognitive Service." @@ -36471,7 +36471,7 @@ "cognitive_service_dependencies": { "condition": "[not(variables('useExistingService'))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('cognitive_service_dependencies-{0}', uniqueString('cognitive_service_dependencies', deployment().name))]", "properties": { "expressionEvaluationOptions": { @@ -36523,8 +36523,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.38.33.27573", - "templateHash": "15241939215263215278" + "version": "0.37.4.10188", + "templateHash": "13460231442167589477" } }, "definitions": { @@ -37557,7 +37557,7 @@ "count": "[length(coalesce(parameters('privateEndpoints'), createArray()))]" }, "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('{0}-cognitiveService-PrivateEndpoint-{1}', uniqueString(deployment().name, parameters('location')), copyIndex())]", "subscriptionId": "[split(coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'resourceGroupResourceId'), resourceGroup().id), '/')[2]]", "resourceGroup": "[split(coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'resourceGroupResourceId'), resourceGroup().id), '/')[4]]", @@ -38308,7 +38308,7 @@ "secretsExport": { "condition": "[not(equals(parameters('secretsExportConfiguration'), null()))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('{0}-secrets-kv', uniqueString(deployment().name, parameters('location')))]", "subscriptionId": "[split(tryGet(parameters('secretsExportConfiguration'), 'keyVaultResourceId'), '/')[2]]", "resourceGroup": "[split(tryGet(parameters('secretsExportConfiguration'), 'keyVaultResourceId'), '/')[4]]", @@ -38332,8 +38332,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.38.33.27573", - "templateHash": "14205022069293553223" + "version": "0.37.4.10188", + "templateHash": "16820585289183726708" } }, "definitions": { @@ -38452,7 +38452,7 @@ "aiProject": { "condition": "[or(not(empty(parameters('projectName'))), not(empty(parameters('azureExistingAIProjectResourceId'))))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('{0}-ai-project-{1}-deployment', parameters('name'), parameters('projectName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -38486,8 +38486,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.38.33.27573", - "templateHash": "12063034585175087716" + "version": "0.37.4.10188", + "templateHash": "17960517774072558100" } }, "definitions": { @@ -38647,7 +38647,7 @@ "existing_cognitive_service_dependencies": { "condition": "[variables('useExistingService')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('existing_cognitive_service_dependencies-{0}', uniqueString('existing_cognitive_service_dependencies', deployment().name))]", "subscriptionId": "[variables('existingCognitiveServiceDetails')[2]]", "resourceGroup": "[variables('existingCognitiveServiceDetails')[4]]", @@ -38704,8 +38704,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.38.33.27573", - "templateHash": "15241939215263215278" + "version": "0.37.4.10188", + "templateHash": "13460231442167589477" } }, "definitions": { @@ -39738,7 +39738,7 @@ "count": "[length(coalesce(parameters('privateEndpoints'), createArray()))]" }, "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('{0}-cognitiveService-PrivateEndpoint-{1}', uniqueString(deployment().name, parameters('location')), copyIndex())]", "subscriptionId": "[split(coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'resourceGroupResourceId'), resourceGroup().id), '/')[2]]", "resourceGroup": "[split(coalesce(tryGet(coalesce(parameters('privateEndpoints'), createArray())[copyIndex()], 'resourceGroupResourceId'), resourceGroup().id), '/')[4]]", @@ -40489,7 +40489,7 @@ "secretsExport": { "condition": "[not(equals(parameters('secretsExportConfiguration'), null()))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[format('{0}-secrets-kv', uniqueString(deployment().name, parameters('location')))]", "subscriptionId": "[split(tryGet(parameters('secretsExportConfiguration'), 'keyVaultResourceId'), '/')[2]]", "resourceGroup": "[split(tryGet(parameters('secretsExportConfiguration'), 'keyVaultResourceId'), '/')[4]]", @@ -40513,8 +40513,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.38.33.27573", - "templateHash": "14205022069293553223" + "version": "0.37.4.10188", + "templateHash": "16820585289183726708" } }, "definitions": { @@ -40633,7 +40633,7 @@ "aiProject": { "condition": "[or(not(empty(parameters('projectName'))), not(empty(parameters('azureExistingAIProjectResourceId'))))]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('{0}-ai-project-{1}-deployment', parameters('name'), parameters('projectName')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -40667,8 +40667,8 @@ "metadata": { "_generator": { "name": "bicep", - "version": "0.38.33.27573", - "templateHash": "12063034585175087716" + "version": "0.37.4.10188", + "templateHash": "17960517774072558100" } }, "definitions": { @@ -40918,7 +40918,7 @@ }, "avmAiServices_cu": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.cognitive-services.account.content-understanding.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -43513,14 +43513,14 @@ "dependsOn": [ "avmContainerApp", "avmManagedIdentity", - "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]", "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').contentUnderstanding)]", + "[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]", "virtualNetwork" ] }, "avmContainerAppEnv": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.app.managed-environment.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -43545,7 +43545,7 @@ "systemAssigned": true } }, - "appLogsConfiguration": "[if(parameters('enableMonitoring'), createObject('value', createObject('destination', 'log-analytics', 'logAnalyticsConfiguration', createObject('customerId', reference('logAnalyticsWorkspace').outputs.logAnalyticsWorkspaceId.value, 'sharedKey', listOutputsWithSecureValues('logAnalyticsWorkspace', '2025-04-01').primarySharedKey))), createObject('value', null()))]", + "appLogsConfiguration": "[if(parameters('enableMonitoring'), createObject('value', createObject('destination', 'log-analytics', 'logAnalyticsConfiguration', createObject('customerId', reference('logAnalyticsWorkspace').outputs.logAnalyticsWorkspaceId.value, 'sharedKey', listOutputsWithSecureValues('logAnalyticsWorkspace', '2022-09-01').primarySharedKey))), createObject('value', null()))]", "workloadProfiles": { "value": [ { @@ -44456,7 +44456,7 @@ }, "avmContainerRegistryReader": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.managed-identity.user-assigned-identity.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -44948,7 +44948,7 @@ }, "avmContainerApp": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.app.container-app.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -46545,7 +46545,7 @@ }, "avmContainerApp_API": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.app.container-app-api.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -48206,7 +48206,7 @@ }, "avmContainerApp_Web": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.app.container-app-web.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -49830,7 +49830,7 @@ }, "avmCosmosDB": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.document-db.database-account.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -55760,7 +55760,7 @@ }, "avmAppConfig": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.app.configuration-store.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -55856,14 +55856,18 @@ "name": "APP_CPS_PROCESSES", "value": "cps-processes" }, - { - "name": "APP_LOGGING_ENABLE", - "value": "False" - }, { "name": "APP_LOGGING_LEVEL", "value": "INFO" }, + { + "name": "AZURE_PACKAGE_LOGGING_LEVEL", + "value": "WARNING" + }, + { + "name": "AZURE_LOGGING_PACKAGES", + "value": "" + }, { "name": "APP_MESSAGE_QUEUE_EXTRACT", "value": "content-pipeline-extract-queue" @@ -55898,7 +55902,7 @@ }, { "name": "APP_COSMOS_CONNSTR", - "value": "[listOutputsWithSecureValues('avmCosmosDB', '2025-04-01').primaryReadWriteConnectionString]" + "value": "[listOutputsWithSecureValues('avmCosmosDB', '2022-09-01').primaryReadWriteConnectionString]" } ] }, @@ -58107,7 +58111,7 @@ "avmAppConfig_update": { "condition": "[parameters('enablePrivateNetworking')]", "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.app.configuration-store.update.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -60346,7 +60350,7 @@ }, "avmContainerApp_update": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.app.container-app-update.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { @@ -61945,7 +61949,7 @@ }, "avmContainerApp_API_update": { "type": "Microsoft.Resources/deployments", - "apiVersion": "2025-04-01", + "apiVersion": "2022-09-01", "name": "[take(format('avm.res.app.container-app-api.update.{0}', variables('solutionSuffix')), 64)]", "properties": { "expressionEvaluationOptions": { diff --git a/src/ContentProcessor/src/libs/application/application_configuration.py b/src/ContentProcessor/src/libs/application/application_configuration.py index fedbc182..fcae6340 100644 --- a/src/ContentProcessor/src/libs/application/application_configuration.py +++ b/src/ContentProcessor/src/libs/application/application_configuration.py @@ -20,8 +20,9 @@ class AppConfiguration(ModelBaseSettings): app_message_queue_interval (int): The interval for the message queue. app_message_queue_visibility_timeout (int): The visibility timeout for the message queue. app_message_queue_process_timeout (int): The process timeout for the message queue. - app_logging_enable (bool): Flag to enable or disable logging. app_logging_level (str): The logging level to be used. + azure_package_logging_level (str): The logging level for Azure packages. + azure_logging_packages (str): The list of Azure logging packages. app_cps_processes (str): Folder name CPS processes name in Blob Container. app_cps_configuration (str): Folder CPS configuration name Blob Container. app_content_understanding_endpoint (str): The endpoint for content understanding Service. @@ -39,8 +40,9 @@ class AppConfiguration(ModelBaseSettings): app_message_queue_interval: int app_message_queue_visibility_timeout: int app_message_queue_process_timeout: int - app_logging_enable: bool app_logging_level: str + azure_package_logging_level: str + azure_logging_packages: str app_cps_processes: str app_cps_configuration: str app_content_understanding_endpoint: str diff --git a/src/ContentProcessor/src/libs/base/application_main.py b/src/ContentProcessor/src/libs/base/application_main.py index d9b1c93a..453f228d 100644 --- a/src/ContentProcessor/src/libs/base/application_main.py +++ b/src/ContentProcessor/src/libs/base/application_main.py @@ -37,12 +37,11 @@ def __init__(self, env_file_path: str | None = None, **data): self.application_context = AppContext() self.application_context.set_configuration(AppConfiguration()) - if self.application_context.configuration.app_logging_enable: - # Read Configuration for Logging Level as a Text then retrive the logging level - logging_level = getattr( - logging, self.application_context.configuration.app_logging_level - ) - logging.basicConfig(level=logging_level) + # Read Configuration for Logging Level as a Text then retrive the logging level + logging_level = getattr( + logging, self.application_context.configuration.app_logging_level, logging.INFO + ) + logging.basicConfig(level=logging_level) def _load_env(self, env_file_path: str | None = None): # if .env file path is provided, load it diff --git a/src/ContentProcessor/src/tests/test_main.py b/src/ContentProcessor/src/tests/test_main.py index 1df40435..36aea485 100644 --- a/src/ContentProcessor/src/tests/test_main.py +++ b/src/ContentProcessor/src/tests/test_main.py @@ -48,8 +48,9 @@ async def test_application_run(mocker): ConfigItem("app_message_queue_interval", "2"), ConfigItem("app_message_queue_visibility_timeout", "1"), ConfigItem("app_message_queue_process_timeout", "2"), - ConfigItem("app_logging_enable", "True"), ConfigItem("app_logging_level", "DEBUG"), + ConfigItem("azure_package_logging_level", "DEBUG"), + ConfigItem("azure_logging_packages", "test_package"), ConfigItem("app_cps_processes", "4"), ConfigItem("app_cps_configuration", "value"), ConfigItem( diff --git a/src/ContentProcessorAPI/app/appsettings.py b/src/ContentProcessorAPI/app/appsettings.py index d69385da..c4aeeeb0 100644 --- a/src/ContentProcessorAPI/app/appsettings.py +++ b/src/ContentProcessorAPI/app/appsettings.py @@ -29,8 +29,9 @@ class AppConfiguration(ModelBaseSettings): app_cps_processes: str app_message_queue_extract: str app_cps_max_filesize_mb: int - app_logging_enable: bool app_logging_level: str + azure_package_logging_level: str + azure_logging_packages: str # Read .env file @@ -45,14 +46,26 @@ class AppConfiguration(ModelBaseSettings): app_config = AppConfiguration() -if app_config.app_logging_enable: - # Read Configuration for Logging Level as a Text then retrive the logging level - logging_level = getattr( - logging, app_config.app_logging_level +# Configure logging +# Basic application logging (default: INFO level) +AZURE_BASIC_LOGGING_LEVEL = app_config.app_logging_level.upper() +# Azure package logging (default: WARNING level to suppress INFO) +AZURE_PACKAGE_LOGGING_LEVEL = app_config.azure_package_logging_level.upper() +AZURE_LOGGING_PACKAGES = ( + app_config.azure_logging_packages.split(",") if app_config.azure_logging_packages else [] +) + +# Basic config: logging.basicConfig with formatted output +logging.basicConfig( + level=getattr(logging, AZURE_BASIC_LOGGING_LEVEL, logging.INFO), + format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", +) + +# Package config: Azure loggers set to WARNING to suppress INFO +for logger_name in AZURE_LOGGING_PACKAGES: + logging.getLogger(logger_name).setLevel( + getattr(logging, AZURE_PACKAGE_LOGGING_LEVEL, logging.WARNING) ) - logging.basicConfig(level=logging_level) -else: - logging.disable(logging.CRITICAL) # Dependency Function