Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions infra/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,9 @@ module webSite 'modules/web-sites.bicep' = {
AZURE_SEARCH_STRICTNESS: azureSearchStrictness
AZURE_OPENAI_EMBEDDING_NAME: embeddingModel
AZURE_OPENAI_EMBEDDING_ENDPOINT : aiFoundryAiServices.outputs.endpoint
AZURE_BASIC_LOGGING_LEVEL: 'INFO'
AZURE_PACKAGE_LOGGING_LEVEL: 'WARNING'
AZURE_LOGGING_PACKAGES: ''
SQLDB_SERVER: sqlServerFqdn
SQLDB_DATABASE: sqlDbName
USE_INTERNAL_STREAM: useInternalStream
Expand Down
9 changes: 6 additions & 3 deletions infra/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.37.4.10188",
"templateHash": "16197733130303817508"
"templateHash": "10200691163213391924"
}
},
"parameters": {
Expand Down Expand Up @@ -29912,8 +29912,8 @@
}
},
"dependsOn": [
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]",
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').aiServices)]",
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').cognitiveServices)]",
"logAnalyticsWorkspace",
"userAssignedIdentity",
"virtualNetwork"
Expand Down Expand Up @@ -39522,8 +39522,8 @@
}
},
"dependsOn": [
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageQueue)]",
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageBlob)]",
"[format('avmPrivateDnsZones[{0}]', variables('dnsZoneIndex').storageQueue)]",
"keyvault",
"userAssignedIdentity",
"virtualNetwork"
Expand Down Expand Up @@ -49989,6 +49989,9 @@
"AZURE_SEARCH_STRICTNESS": "[variables('azureSearchStrictness')]",
"AZURE_OPENAI_EMBEDDING_NAME": "[parameters('embeddingModel')]",
"AZURE_OPENAI_EMBEDDING_ENDPOINT": "[reference('aiFoundryAiServices').outputs.endpoint.value]",
"AZURE_BASIC_LOGGING_LEVEL": "INFO",
"AZURE_PACKAGE_LOGGING_LEVEL": "WARNING",
"AZURE_LOGGING_PACKAGES": "",
"SQLDB_SERVER": "[variables('sqlServerFqdn')]",
"SQLDB_DATABASE": "[variables('sqlDbName')]",
"USE_INTERNAL_STREAM": "[variables('useInternalStream')]",
Expand Down
5 changes: 5 additions & 0 deletions src/App/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ AZURE_OPENAI_ENDPOINT=
AZURE_OPENAI_EMBEDDING_NAME="text-embedding-ada-002"
AZURE_OPENAI_EMBEDDING_ENDPOINT=

# Logging settings
AZURE_BASIC_LOGGING_LEVEL="INFO"
AZURE_PACKAGE_LOGGING_LEVEL="WARNING"
# AZURE_LOGGING_PACKAGES="azure.core.pipeline.policies.http_logging_policy,azure.identity.aio._internal,azure.monitor.opentelemetry.exporter.export._base"

# User Interface
UI_TITLE=
UI_LOGO=
Expand Down
21 changes: 13 additions & 8 deletions src/App/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,23 @@
)

# Configure logging
logging.basicConfig(level=logging.INFO)
basic_level = getattr(
logging, config.AZURE_BASIC_LOGGING_LEVEL.upper(), logging.INFO
)
logging.basicConfig(level=basic_level)

# Suppress INFO logs from 'azure.core.pipeline.policies.http_logging_policy'
logging.getLogger("azure.core.pipeline.policies.http_logging_policy").setLevel(
logging.WARNING
# Configure Azure package logging levels
azure_packages_env = os.environ.get("AZURE_LOGGING_PACKAGES")
azure_packages = (
[pkg.strip() for pkg in azure_packages_env.split(',')]
if azure_packages_env else []
)
logging.getLogger("azure.identity.aio._internal").setLevel(logging.WARNING)

# Suppress info logs from OpenTelemetry exporter
logging.getLogger("azure.monitor.opentelemetry.exporter.export._base").setLevel(
logging.WARNING
package_level = getattr(
logging, config.AZURE_PACKAGE_LOGGING_LEVEL.upper(), logging.WARNING
)
for package in azure_packages:
logging.getLogger(package).setLevel(package_level)


def create_app():
Expand Down
8 changes: 8 additions & 0 deletions src/App/backend/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ def __init__(self):
"APPLICATIONINSIGHTS_CONNECTION_STRING"
)

# Azure Logging Configuration
self.AZURE_BASIC_LOGGING_LEVEL = os.environ.get(
"AZURE_BASIC_LOGGING_LEVEL", "INFO"
)
self.AZURE_PACKAGE_LOGGING_LEVEL = os.environ.get(
"AZURE_PACKAGE_LOGGING_LEVEL", "WARNING"
)

self.DEBUG = os.environ.get("DEBUG", "false")

# Current minimum Azure OpenAI version supported
Expand Down