Step1: Add dependency in pom.xml file.
Step2: Need to add below logger code snippet in log4j2.xml file in your application.

Step3: Need to change as below code snippet in
applicationContext.xml in your application.
Step 4: Restart the server and check the console.