dotnet / aspire

Tools, templates, and packages to accelerate building observable, production-ready apps
https://learn.microsoft.com/dotnet/aspire
MIT License
3.83k stars 457 forks source link

Set Dapr Log Level #1468

Closed tonysneed closed 10 months ago

tonysneed commented 10 months ago

How is it possible to set the log level for Dapr in an Aspire project?

When running Dapr projects from the command line, it can be done as follows:

dapr run --app-id api --app-port 5096 --log-level debug --enable-api-logging -- dotnet run

Can this, for example, be performed via config in the Aspire AppHost project?

davidfowl commented 10 months ago

You can do this today by setting the DaprSidecarOptions in the call to WithDaprSideCar

tonysneed commented 10 months ago

Perfect - thanks! 👍

tonysneed commented 10 months ago

Here is the code from Program.cs in the .AppHost project.

builder.AddProject<Projects.AspireWithDapr_ApiService>("apiservice")
       .WithDaprSidecar(new DaprSidecarOptions { AppId = "api", LogLevel = "debug", EnableApiLogging = true });

builder.AddProject<Projects.AspireWithDapr_Web>("webfrontend")
    .WithDaprSidecar(new DaprSidecarOptions { AppId = "web", LogLevel = "debug", EnableApiLogging = true });