I am using Azure Spring Apps, and I am deploying a very simple Spring App
I have deployed my spring app to azure like so :
az spring app deploy --resource-group myResourceGroup --service myService --name myName --artifact-path target/myApp-0.1.0.jar
On the azure portal it says that the deployment has "failed"
I would like to view my app logs to see what went wrong, as everything works fine for me locally.
Is there a straightforward simple way to view my spring boot logs in azure?
You can use Azure CLI to get logs:
az spring app log tail -n xxx -s xxx -g xxx --subscription xxx --lines 200
Refs: https://learn.microsoft.com/en-us/cli/azure/spring-cloud/app/log?view=azure-cli-latest
Related
I'm currently upgrading an application from Spring Boot 2.7.7 to Spring Boot 3.0.2 and hit a 404 at the tomcat.
The interesting thing is that the application works fine on my local machine, but not in the Azure Cloud.
I have the log-level set to DEBUG for org.springframework.web and with Spring Boot 2.7.7 I see the call received in the logs (on Azure) for actuator/info, whereas in Spring Boot 3 I see the application starting successfully but then no further logs.
Any ideas what it could be or what I can try out to debug further?
The problem is related to a change in Tomcat version in Spring 2.7.8 (and therefore also Spring Boot 3.x) in relation to the Java-Agent used in Docker / within Azure.
Update to the latest java-agent version in the Docker-Image:
DockerFile
FROM eclipse-temurin:17
COPY "myBuiltApplication.jar" "app.jar"
ADD "https://github.com/microsoft/ApplicationInsights-Java/releases/download/**3.4.8**/applicationinsights-agent-*3.4.8*.jar" "agent.jar"
EXPOSE 80
ENTRYPOINT [ "java", "-javaagent:agent.jar", "-jar", "app.jar"]
Make sure that no other agent is active from Azure
I had to remove the JAVA_TOOL_OPTIONS and StartupBootstrapper from the docker run:
- docker run -d --expose=80 --name myapp
JAVA_TOOL_OPTIONS=-javaagent:/agents/java/applicationinsights-agent-codeless.jar -e StartupBootstrapper=Microsoft.ApplicationInsights.StartupBootstrapper -e
I experienced the same issue with Spring Boot version 2.7.8 with the exact same behavior: Starting the app local in IDE as well as starting the docker image locally worked perfect. When running this image in Azure as an App Service no http call is going to spring. For me it looks like Tomcat has an issue as the 404 seems to be produced by Tomcat.
Downgrading to Spring Boot 2.7.7 fixed the issue again.
I am working on a new webapp in azure cloud.
The challenge is that I am working on a new python module that I dont know that well, Pyspice. Pyspice interface to a program Ngpspice.
On my windows PC it works fine but not on the cloud. So I would like to be able to do debugging without pushing and then wait 25min for each build.
Right now I am using SSH to connect to the webapp. Then I can create a simple python script to see if I can get the connection to work between pyspice and ngspice. The challenge I have is that when I run python in SSH then it uses a different environment than the webapp, i.e. all the modules in the requirements.txt is not available. So how can I change environment to be able to debug?
I have created an Azure App service with Python version 3.8, when I check the version in Azure SSH it is showing me different version.
To install the latest version in Azure SSH, run the below command
apt update
apt install python3.9
python --version
Run the below command to change the python version of the Azure App service in Azure Cloud Shell (Bash).
az webapp config set --resource-group MyRGName --name WebAppName --linux-fx-version "PYTHON|3.9"
To check the updated version, run the below command
az webapp config show --resource-group MyRGName --name Python4Nov --query linuxFxVersion
debug azure webapp using ssh
To remote debug Azure Linux App Service, we need to open a TCP Tunnel from the development machine to Azure App Service.
Configure for SSH and Remote Debugging
In Azure CLI run the below command
az webapp create-remote-connection --resource-group MyRG -n WebAppName
References taken from MSDoc
Is there any way to see logs.I mean I am able to see logs in log section in cloud run It only show me http log or show me the response(like 403 etc) but does not show me the response like (invalid current password etc.) of error.
I see there is --log-driver gcplogs option but don't know where to configure it I mean its a serverless container so not running any docker run command
Google Cloud Logging captures stdout and stderr of services (containers) deployed to Google Cloud Run.
You should be able to view these logs either through the the Cloud Console's Logs Viewer (https://console.cloud.google.com/logs/query) or using gcloud.
If you use gcloud, you can read the last 15-minutes' (--freshness=15m) logs for all Cloud Run services in a project (${PROJECT}) with:
PROJECT="[[YOUR-PROJECT-ID]]
gcloud logging read \
"resource.type=\"cloud_run_revision\"" \
--project=${PROJECT} \
--freshness=15m
For a specific service's stderr:
PROJECT=...
SERVICE=...
gcloud logging read \
"resource.type=\"cloud_run_revision\" resource.labels.service_name=\"${SERVICE}\"" \
--project=${PROJECT} \
--freshness=15m
To that service's stderr text payload only:
gcloud logging read \
"resource.type=\"cloud_run_revision\" resource.labels.service_name=\"${SERVICE}\"" \
--project=${PROJECT} \
--freshness=15m \
--format="value(textPayload)"
It's a powerful tool.
Checkout the full logs buy clicking the popout icon in the LOGS pane. This will show all the logs for your Cloud Run service.
I have deployed a web app bot in Azure. I am trying to update it's application settings using Azure Cli. Please find the commands below:
az webapp config appsettings set -g <ResourceGroup> -n <ResourceName> --subscription <AZsubscription> --settings SettingToChange=SettingValue
The command fails saying that it was not able to find Resource under the Resource Group mentioned in the command.
I think the above command is for azure web app and not for web app bot. What command should I use to update application settings for web app bot ?
Thanks
I think the above command is for azure web app and not for web app bot. What command should I use to update application settings for web app bot ?
No, the command az webapp config appsettings set should work for the azure web app bot, I test it on my side, it works fine. I think you need to make sure you have passed the correct parameters.
My specific test command:
az webapp config appsettings set -g joywebapp -n joywebbot --subscription <subscription id> --settings testkey=test1
Result:
Check in the portal:
I successfully registered three apps named appSink, appSource and appProcessor as follows
dataflow:>app register --name appSource --type source --uri maven://com.example:source:jar:0.0.1-SNAPSHOT --force
Successfully registered application 'source:appSource'
dataflow:>app register --name appProcessor --type processor --uri maven://com.example:processor:jar:0.0.1-SNAPSHOT --force
Successfully registered application 'processor:appProcessor'
dataflow:>app register --name appSink --type sink --uri maven://com.example:sink:jar:0.0.1-SNAPSHOT --force
Successfully registered application 'sink:appSink'
dataflow:>app list
╔══════════╤═════════════╤════════╤════╗
║ source │ processor │ sink │task║
╠══════════╪═════════════╪════════╪════╣
║appSource│appProcessor│appSink│ ║
╚══════════╧═════════════╧════════╧════╝
I then created and deployed a stream as follows:
dataflow:>stream create --name myStream --definition 'appSource | appProcessor | appSink’
Created new stream 'myStream'
dataflow:>stream deploy --name myStream
I get the message
Deployment request has been sent for stream 'myStream'
In the streams list I see
║myStream1 │source-app | processor-app | sink-app│The stream is being deployed. ║
The deployment never finishes it seems. The data flow server logs are just stuck on this
o.s.c.d.spi.local.LocalAppDeployer : Deploying app with deploymentId myStream1.source-app instance 0.
Why is my stream not deploying successfully?
Do you see any java processes running in your local (that correspond to the applications being deployed)?
You can try remote debugging your application deployment using the doc: https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#_remote_debugging
You can also try inheriting the apps logging using
https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#_log_redirect
I am seeing this same problem. I inherited the logging as you suggested. The UI never moves off of Deploying status. There are no errors in the logs and my stream is working when I test it.
Add spring boot actuator dependency in your project, dataflow calls /health and /info to see if the app is deployed or not.