What to cover: 1. Log4j2 dependencies. 2. XML Configuration of Log4j2 file. 3. Define and appenders and message format in XML file. 4. Call logger in Java code. 5. Java code to print log in file. Step 1: Create Java maven project in Eclipse, Intelli or any other Java IDE. Step 2: Check (skip archetype selection) and…