Hi I have simple application where I want to implement the logs so when the error occured I can view the error in a file in Azure.
I read some article they do describe to view the error monitoring. What I actually want to see the error that are added into some file. So when there an error occured in a deployed app, I should be able to go to the log file and read the error or information.
Simple enough I have created a new ASP.NET 6 API which comes wiht the Ilogger. Now cosider if I deploy this app to the Azure and if there is an error how I can see it in a file?
--Above is my original question. After implemenation the proposed solution I am still unable to view the log file or logs any where in the Azure. please see the code and images. I have verified locally in console the information and error are being logged but not showing up in any where in azure.
appsettings.
program.cs
information log and error log






When we deploy
.NET Core ApptoAzure App service(usingVisual Studio Publish option/GitHub Actions/VS Publish Import Profile), by defaultWeb.configfile will be generated in the deployment process.site/wwwroot.The easiest way to check the logs in a file is by changing the
stdoutLogEnabledvalue totrue.Open the
web.configfile by clicking on edit button.After updating the
stdoutLogEnabledvalue. Run the application. If there are any errors/unable to access the deployed URL, a file with clear error info will be generated inLogfilesfolder.Path: -
C:\home\LogFilesCheck the
Note sectionin the SOThread to work withweb.configlocally.Using
AddAzureWebAppDiagnostics:As mentioned in the MSDoc,
Refer first section in the SOthread which I have posted.
In
App Service logs,enable theApplication loggingand change the Logging level toError.