I'm going to assume that you want to persist Web API logs. The following are the steps to get logging working using the hosted Blazor WASM template in Visual studio.
Update the weather forecast action to write some information to log.
[HttpGet]
public IEnumerable<WeatherForecast> Get()
{
_logger.LogInformation("This is an information log...");
_logger.LogWarning("This is an warning log...");
_logger.LogError("This is an error log...");
return Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = DateTime.Now.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
})
.ToArray();
}
Deploy the server application to the file system, pick a target folder, and set stdoutLogEnabled="true" in the web.config. Remember the target folder and path.
In IIS manger create a new application pointing to the target folder. The folder where you deployed the server application.
Set permissions on the folder so the application pool identity can write to the target folder. Right click the folder -> properties -> security. The application username is...
IIS APPPOOL\NameOfYourApp
Make sure the user has read/write access to the folder. If you do not remember what you named the application, just look in IIS.
Browser the application from IIS or enter the URL in your browser.
You should start seeing logs in .\logs. It might take a while. Stop and restart the application if you are impatient. The warning and error logs also end up in the Event Viewer. The event view will also show error if the application identity cannot write to the .\logs folder.
If you want a different configuration then read the logging documentation and configure your application accordingly.