Why is logging important in any application?
Logging is very important to any application. It helps us get information about the application is running. This helps us debug if any failure occurs Log4j In Selenium Web driver.
Log4j In Selenium Web driver
Log4j is an excellent logging API available both on Java and .net construction.
Advantages are:
- It having good logging infrastructure without putting in any efforts.
- They provide the ability to categorize logs at different levels.
- Log4j gives the capability to steer logs to different outputs.
- This provides the capability to determine the format of output logs.
- provides the ability to write Asynchronous logs. which helps to raise the performance of the application.
- Loggers in Log4j follow a school hierarchy. which might come helpful to applications.
If not able to understand these tips then don't stress. Things are certain to get clearer once we approach the end of Log4j Article series Log4j In Selenium Web driver.
Log4j
Log4j involves four main components
- LogManager
- Loggers
- Appenders
- Layouts
With these comes some extra components. which covered in the individual headings in following tutorials
LogManager
This is actually the static class. that helps us get loggers with different labels and hierarchy. It able to consider LogManager as a manufacturing plant producing logger items.
Logger
This is a course which helps you log information at different logging levels. that we have created a logger called the main logger using the LogManager static class. we use it to create logs. we have mainLogger.info statement logs the string.
Appenders
This item that assists Logger objects to write logs to different outputs. Appenders can specify a file, system or a data foundation as the result location. we've used a gaming system appender to printing logs like using System.out or System.err.
Layouts
Layout course helps us identify the log information should appear in the outputs.