I recently read a Gain Java Knowledge article about logging Spring Boot Request and Response. I really like the idea so I decided to test it in practice. How to logging Spring Boot Request and Response? Request and response body for each endpoint we can print using Servlet Filter. Inside our controller class we will not log any statement but our filter class will log the request and response body for each API call. So this approach will reduce the lines of code and we don’t need to worry about to add log statements in each API to print Request and response body. The Filter class will be used to log requests and responses for each API. LoggingFilter class will extends OncePerRequestFilter class because this is Filter base class that aims to guarantee a single execution per request dispatch, on any servlet container. It provides a doFilterInternal method with HttpServletRequest and HttpServletResponse arguments. Conclusion: In my opinion, this is the best solution to log request...
Jenkins is an open source, Java-based automation server that offers an easy way to set up a continuous integration and continuous delivery (CI/CD) pipeline. Continuous Integration (CI) is the process of automating the build and testing of code every time a team member commits changes to version control. Continuous Delivery (CD) is the process to build, test, configure and deploy from a build to a production environment. Jenkins docker image with docker inside Step 1/ Create Dockerfile extending the official Alpine image. Then get jenkins.war and docker from official sites. Step 2/ Jenkins admin user setup to set a default admin user and password, by creating a Groovy script file. Step 3/ Adding Plugins to auto install some selected plugins. Step 4/ Build Your Custom Jenkins Image Here is a fully functional Jenkins server.
Every application that is deployed on production needs some kind of monitoring to see how the application is performing. This will give you some insights on whether the application is performing as aspected or if you would need to take some action in order to obtain the desired level of performance. In the modern world, this data is called Application Performance Metrics (APM). Let’s try to set up a basic Springboot App monitoring with a Grafana Dashboard and Prometheus.