Fix Oracle Logon Denied Error In Pivotal Cloud Foundry

Introduction Are you getting logon denied error while starting or deploying your Spring Boot application into Pivotal Cloud Foundry (PCF) cloud environment? Generally, logon denied error occurs while your application is trying to connect to database server. The error you get in your application log is similar to the following error: From the above error message it is clear that…

Spring Boot Profile Based Logging

Profile Based Logging Here in this example, I am going to show you how to create Spring Boot profile based logging. For any applications logging is an important things which will help you to debug through your application errors or issues and you can fix them easily by analyzing those errors or issues from the log files. Let’s say you…

How To Log Online User Activity In Spring Boot Applications

Introduction Here I am going to build a system to log online user activity in Spring Boot applications using HandlerInterceptor interface. As an application owner you may want to track your user activities, such as, which page they are accessing, from where requests were made to your application, from which pages to which pages they are moving, etc. If your…

ELK Stack Integration with Spring Boot Applications

Introduction The ELK Stack is made of three open-source products: 1) Elasticsearch, 2) Logstash, and 3) Kibana. Elasticsearch: It is a NoSQL database which is based on the open-source search engine called Lucene. So Elasticsearch is a search and analytics engine. Logstash: It is a data processing pipeline tool which accepts inputs from (multiple) sources, performs different transformations, and exports…

How to Trace Microservices Logs with Spring Cloud Sleuth and Zipkin

Introduction Here I am going to explain how to trace Spring Boot Microservices logs with Spring Cloud Sleuth and Zipkin Server. Spring Cloud Sleuth provides Spring Boot auto-configuration for distributed tracing. One of the problems most developers face difficulty of tracing logs as your microservices applications grow and requests propagate from one microservice to another microservice. So it could be…

How to log with Lombok using @slf4j annotation in Java, Spring and Spring Boot Applications

Introduction In this tutorial I will show you how to configure Lombok for logging using @slf4j annotation in Java, Spring and Spring Boot applications. The example shown here will work for Java, Spring and Spring Boot applications. This annotation will reduce the code you write for creating logger variable. Lombok will provide log variable when you use @slf4j annotation on…

Spring Module-Wise Logs Using MDC In Logback

SiftingAppender And MDC In this example you will see how to create or generate separate log file module-wise or for each separate functionality using SiftingAppender in logback with the help of ThreadedContext or MDC in Spring Boot applications. MDC also known as Mapped Diagnostic Context is a lighter technique consists of uniquely stamping each log request servicing a given client….

How to create separate log file for each module using RoutingAppender and MDC (Mapped Diagnostic Context) in log4j2/slf4j

Introduction In this example we will see how to create or generate separate log file module-wise or for each separate functionality using RoutingAppender in log4j2 with the help of ThreadedContext or MDC. MDC or Mapped Diagnostic Context is a lighter technique consists of uniquely stamping each log request servicing a given client. To uniquely stamp each request, the user puts…

How to configure log4j2 in Java, Spring and Spring Boot Applications

Introduction In this tutorial I will show you how to configure log4j2 in Java, Spring and Spring Boot applications. The same log4j2 configuration will work for Java, Spring and Spring Boot applications. I am not going to show you how to use logback API in Spring Boot application, instead I will exclude logback API from the Spring Boot application. I…

Spring Data JPA CRUD Example

Introduction In this tutorial I will show you an example on Spring Data JPA CRUD. Here I will use the embedded or in-memory HSQL database. CRUD means Create, Read, Update, Delete. So I am going to perform basic CRUD operations on some entities. In this example I will create annotation based Spring standalone application. Related Posts: Embedded HSQL Database in…