How to enable the equivalent of Event Viewer logs for Azure PaaS hosted Identity?
For issues with the Identity service, the first thing to consider will be to activate and check the Identity Server logs. To activate them, in the Azure Portal while on the Identity app, open and access App Service Editor. Perform the below,
- Edit file appsettings.json file under the Identity wwwroot folder
- In the targets add the following target
"azureLogFile": {
"type": "File",
"fileName": "./${shortdate}-IdentityApplication.log",
"layout": "${longdate} - ${level:uppercase=true} - ${logger} ${message}${onexception:${newline}${exception:maxInnerExceptionLevel=10:format=shortType,message,stacktrace:separator=*:innerExceptionSeparator=&#[x9;}}",
"archiveEvery":"Day",
"maxArchiveFiles":"5"
}
- In the rules edit the "logger": "*" rule to point to azureLogFile
{
"logger": "*",
"minLevel": "Info",
"writeTo": "azureLogFile"
}
- Restart IdentityServer webapp.
After this operation, Go back to the App Service Editor. The logs should appear in the same folder as appsettings.json, with the name being the current date.