问题
I have deployed a NodeJS application to Linux App Service that logs to stderr and stdout. The diagnostic logs functionality in Linux App Service does not appear to work, as nothing appears in table storage. The only logs in Kudu are from when the docker container is deployed. After that, it logs nothing.
The SSH component in Kudu does not work, even after following the official setup documentation.
Has anyone come up with a way to capture stdout and stderr? or can recommend a library that they have gotten to work successfully with NodeJS on the Linux App Service platform?
回答1:
You could use Azure CLI 2.0 to capture stdout. Try to use the following commands.
az webapp log config -g <resource group name> -n <app name> --application-logging true --detailed-error-messages true --level verbose
az webapp log tail -g <resource group name> -n <app name>
You could get help with -h
root@shui:~# az webapp log config -h
Command
az webapp log config: Configure web app logs.
Arguments
--application-logging : Configure application logging to file system. Allowed values: false,
true.
--detailed-error-messages: Configure detailed error messages. Allowed values: false, true.
--failed-request-tracing : Configure failed request tracing. Allowed values: false, true.
--level : Logging level. Allowed values: error, information, verbose, warning.
--slot -s : The name of the slot. Default to the productions slot if not
specified.
--web-server-logging : Configure Web server logging. Allowed values: filesystem, off,
storage.
More information about Azure Cli supports linux webapp please refer to this link.
来源:https://stackoverflow.com/questions/44419932/capturing-stdout-in-azure-linux-app-service-via-nodejs