Log4j Loggers in Selenium Web Driver

Log4j Loggers

The Object in the Log4j part list is the Logger class. This most critical class need. which gives a chance to log data to the required Log area, be it reassure or a document or even a database Log4j Loggers in Selenium Web Driver.
Lumberjack objects take after pecking order the class progression in any OOP dialect. The naming tradition of Logger chain of importance is in the name.

Log4j Loggers in Selenium Web Driver

Every question name chooses which progression it takes after. For instance, we have a lumberjack named “Main.Utility”. So Utility is the offspring of Main and Main is the father of Utility. Additionally, all Loggers are gotten from root Logger. The real chain of command will be root.Main.Utility with root being the precursor of Utility and Father of Main.

That logger1 is the parent of logger1Child and grandparent of logger grandchild’s. the chain of command of lumberjack objects in light of the application required.

Logging levels

Lumberjack class has following print techniques that assist you to log data.

  • Trace
  • Debug 
  • Info
  • Warn
  • Error
  • Fatal

So let’s print a Debug log take care of business by saying, Logger.Debug. I use some other over-burden Logger.Debug() strategy. All these print explanations called Levels.

The question comes, why do we need log levels?

Each log level expects a specific kind of data. Debug level expects to log of that data. which enables a developer to troubleshoot the application occurrence of disappointments. Error Level anticipates that everyone of the Errors logged utilizing this level.
 set log level of a lumberjack utilizing the Logger.set level strategy. When setting the Log level of lumberjack Lumberjacks with that and the larger amount will be logged. Log levels have following request

Log level Inheritance

As examined in the past parts we realize that Loggers take after the chain of importance. Additionally, Log levels take after the chain of importance. what I mean is that if a Level Hierarchy of a lumberjack is not characterized. then it picked from the Level of the parent. Let’s say we have two Lumberjacks Log4j Loggers in Selenium Web Driver.
LoggerParent and LoggerParent.Child. Logger LoggerParent has log level set to LoggerParent.setLevel to caution. the off chance doesn’t set the Level of Logger youngster. than default logging Level of Child will be set to Level.WARN which is the Level of its parent.

Logging run time Exceptions

This is an essential component of a Logger class, empowers to pass on the special case to the yield. This helpful particularly in the situations where gotten the special case. We additionally need to log the data about the exemption.
The essential point Exception message and the Line number of special case printed.

Log4j Loggers in Selenium Web Driver

We provide Log4j Loggers in Selenium Web Driver in real time training. We offer in real-time project training in selenium training in hyderabad.


Leave a comment