Module 5: Selenium Logging - How to Configure log4j logging to Selenium Automation Framework? - Software Testing

Empowering Technology

Post Top Ad

Responsive Ads Here

Apr 19, 2020

Module 5: Selenium Logging - How to Configure log4j logging to Selenium Automation Framework?

<<< Previous Chapter

Configure log4j logging to Selenium Automation FrameworkApache Log4j logging plays a vital role in providing a fast and reliable framework coded in Java. It's an open source which fits both small scale and large scale projects. It has the ability for both File and Database logging.

Log4j has basically 3 major components: Loggers, Appenders and Layout. These components can be used as per the automation framework requirements they are being embedded in.

I would not be explaining log4j in detail in this Lockdown Special Automation Framework design series as it itself is a very lengthy topis to talk about. Let's go ahead and integrate Log4j to our framework:

Create a Log4J.xml file at root directory as we created folders yesterday.
  • This file will be used to:
  • Configure logging.
  • Configure logs storage location/Information.
  • Configure the the log file name.
  • Configure Content appender information (Display logs on console or write in a file)
  • Archive existing logs with timestamp and generate new log file for every test execution.
  • Configure Content level information that what all we need to log (Trace/error)
Now our project should look like:

Simply Copy below code snippet in Log4j.xml file. No need to try to understand it as of now, it's a common Log4j Logging Configuration that can be used in any project:

Hope you all are enjoying this Free Tutorial on  Learn to Design an Automation Framework from SCRATCH 

Previous Modules:
Module 0: Intro The Transformers Pledge >>> | Subscription Link?
Module 1: Getting Started with Java and Maven Environment setup
Module 2: Setup & Initialize Automation Framework >>>
Module 3: Understanding and updating pom.xml >>>
Module 4: Designing Selenium Framework Folder Structure

Have a great day! Happy Testing :)

1 comment:

  1. The detailed guide makes it possible to optimize all aspects of the project in accordance with new requirements. The result of the work will be positive


Thanks a lot for your valuable Comment!

Post Bottom Ad

Responsive Ads Here