QA's approach 2 Java - Logging API - Log4j
Log4j Log4j is a Framework(API) written in Java & distributed under Apache Software license, used for debugging. Log4j has 3 main components: 1. loggers: To capture the logging information 2. appenders: To publish the logging information to various destinations. An output destination is called an appender. 3. layouts: To format logging information in different styles. There are three ways to configure log4j: 1. Using properties file. 2. Using Java code programatically. 3. Using XML file. Configuring Log4j using properties files & programmatically Configuring log4j involves the following tasks: 1. Configuring the root logger 2. Configuring individual logger 3. Specifying appenders 4. Specifying message layout Configure the root logger The root logger is the base logger from which other loggers inherits. Syntax for configuring the root logger is as follows: log4j.rootLogger=level[, appender1, appender2…] Where level can be one of the f...
Comments
Post a Comment