So many things can fail when dealing with persistence. We can usually inspect the end result but understanding how it “got there” is often challenging. With verbose SQL we might see the actual SQL call but who generated it and why, they are also often very hard to read and don’t include important information such as the values passed to the prepared query.
This is where Lightrun really shines, it lets you “see” the details in that middle layer. Before the data gets into the database or before the data is sent as a response.
For the purpose of this tutorial I’ll use the pet clinic demo from here: https://github.com/spring-projects/spring-petclinic
It’s a relatively simple demo which includes rest calls. You can use any code since I won’t rely on anything specific to that demo.
Step 1 – Build the Demo
Open the project directory from the repository in IntelliJ. Run the “Package” option in the maven toolwindow.
Step 2 – Install Lightrun
If you didn’t do this yet go to https://app.lightrun.com and follow the steps to create an account. Download the IDE plugin and set up the agent on your server. I won’t replicate the steps here as they are pretty clear on the website.
You can download the agent into the project directory then run the app using:
java -agentpath:PATH_TO_AGENT_DIRECTORY/lightrun_agent.so -jar target/spring-petclinic-2.4.5.jar
Notice you need to replace PATH_TO_AGENT_DIRECTORY with the right path. Try to avoid shortcuts like ~ which might cause issues.
You can now install the plugin and login via the IDE.