How to debug deployed Grails application - debugging

Is there any way to debug Grails application deployed to production server in Intellij IDEA or any other IDE?

You need to start your server in debug mode by adding something like this to the java process start script:
-Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n
Then in IntelliJ open Run > Edit Configurations and select Defaults > Remote, where you can set the port you specified above to debug the remote JVM.
You can do the same in Eclipse.

Also you can use grails-debug run-app to debug Grails application. But I think it's not good choice for production

Also, starting from grails 2.3.0 the jvm is forked into the build vm and the application vm. Using --debug allow you to debug the build vm, and using --debug-fork allows you to debug the app vm. Grails 2.3 forked execution

Related

How to debug apache camel route in quarkus application using eclipse

I want to know, is there anyway to debug my camel route using quarkus framework in eclipse
Start your Quarkus application in debug mode with JVM with;
./mvnw compile quarkus:dev -Ddebug
then attach a debugger to localhost:5005.
if u are use quarkus cli start your application with dev mode
quarkus dev
if u are not use quarkus cli u can use mvn for run quarkus app dev mode
mvn compile quarkus:dev
after run application add remote debugger from eclipse with default quarkus opens 5005 port for debugging

Debug Spring Boot app from Intellij where service is started in a multi service docker-compose file?

I have a docker-compose YML file that includes multiple Spring Boot apps.
Is it possible to debug one of these Spring Boot apps from Intellij?
I guess it depends how the apps are started within the Docker container. One option could be starting the application in debug mode with the following in the Dockerfile of the app you want to debug:
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n -jar myApp.jar
Remember to build your container again and then attach a remote debugger with IntelliJ to the port 8000.

Running Spring Boot Application.main() via IntelliJ doesn't find my local profile

I've been running my Spring Boot (2.1.0) app via Gradle bootRun but since adding in the Actuator, this causes the app to not actually shutdown when I tell IntelliJ to stop the app. For whatever reason, this is only an issue when running in Debug mode.
The solution I found online was to just run the Application.main() but now, my local profile isn't being picked up. So I have the typical application.yml along with various other profiles. All of the developers have an application-local.yml that is sitting at the root of the project and is ignored by git. Running Gradle's bootRun with local as the active profile works. But running Application.main() with the local active profile does not pick up the application-local.yml file's config.
As you can see in the image, I've not only specified the profile in Intellij's Active profiles section, but also as a VM option just like I do when running via Gradle.
One more thing which you can try
Set spring.profiles.active=local in Environment Variables below VM Options

How to debug my Grails application in IntelliJ?

I am using this specific command to run my Grails application clean bootRun -Dgrails.env=test.
I would like run my application (with the same configuration) in debug mode from IntelliJ.
What Run/Debug configurations should be used to run the app in debug mode with the same options as in the command above?

Confuse of run Spring boot 1.3.0 application and specify certain profile

When I use spring boot 1.3.0 rc1, when run application by
mvn spring-boot:run
in console it will output
no profile actived
when you run application with
mvn spring-boot:run -Dspring.profiles.active=test
in console, in will output
profile test are activated
But yesterday when I changed to 1.3.0 release and run application in production,
java -Dspring.profiles.active=production -jar myapp.jar
I can't find above output in console.
In addition, I think it will only load appication-production.properties if you specified production profile, but it not, it still load application.properties.
So all these let me feel confuse and mislead me think prodcution profile cannot effect and run application by this way that is java -jar your.jar could not support -Dspring.profiles.active, meantime my colleague waiting for using my service so it give me many pressure.
Can anyone could explain it ?

Resources