The default LogLevel settings for the application are found in the corresponding appsettings.json
, which may contain the following section -- see here for additional details on Logging in .NET and on Logging Providers in .NET
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
To permanently change the LogLevel, just update the appsettings.json
for the app.
To override a LogLevel at runtime, an environment variable can set the LogLevel value.
For example to set the Logging:LogLevel:Default LogLevel to Debug: export Logging__LogLevel__Default="Debug"
Example using the CLI:
cd src/CarbonAware.CLI
export Logging__LogLevel__Default="Debug"
dotnet run -l westus
Example using the WebApp:
cd src/CarbonAware.WebApi
export Logging__LogLevel__Default="Debug"
dotnet run
Or, to change the LogLevel for just one run of the app:
cd src/CarbonAware.WebApi
Logging__LogLevel__Default="Debug" dotnet run
The LocationSource
converts named locations to their corresponding geoposition coordinates based on JSON files containing those values.
To generate a new version of the src/data/location-sources/azure-regions.json
file, follow these steps:
-
Get a list of Azure regions metadata in the proper format:
-
az account list-locations --query "[?metadata.latitude != null].{RegionName:name,Latitude:metadata.latitude,Longitude:metadata.longitude }" >> azure-regions.json
-
-
Copy the results and save it to
src/data/location-sources/
Data files are stored in the src/data/data-files
directory.
All files placed in that directory will be copied into the user-interface project (CLI, WebApi, etc) at build time.