Skip to content
Merged
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
2 changes: 1 addition & 1 deletion docs/CustomizingAzdParameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
By default this template will use the environment name as the prefix to prevent naming collisions within Azure. The parameters below show the default values. You only need to run the statements below if you need to change the values.


> To override any of the parameters, run `azd env set <PARAMETER_NAME> <VALUE>` before running `azd up`. On the first azd command, it will prompt you for the environment name. Be sure to choose 3-20 charaters alphanumeric unique name.
> To override any of the parameters, run `azd env set <PARAMETER_NAME> <VALUE>` before running `azd up`. On the first azd command, it will prompt you for the environment name. Be sure to choose 3-20 characters alphanumeric unique name.

## Parameters

Expand Down
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
121 changes: 62 additions & 59 deletions infra/main.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions infra/main_custom.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,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
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 pkg.strip()]
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
Loading