What Is Log4J In Java | How To Use Log4J In Java | Creation Of Properties File In Java || H2KInfosys

preview_player
Показать описание
What Is Log4J In Java | How To Use Log4J In Java | Creation Of Properties File In Java

H2K Infosys, LLC provides services in complete Software Development Life Cycle (SDLC) right from requirement gathering, analyzing product requirements based on client need, design, technical documentation, coding, testing and ongoing support. H2K Infosys has a team of people with experience in Manual Testing, Automation testing, Performance tuning and Performance testing.

• Log4J is a third party API used for the purpose of creating logging information at runtime
• Logging information means it will create log file with information such as time of execution, date of execution, etc…logging information can be for development codes for testing scripts
• Getting log information helps us to understand the root cause of failure or success of a test script or a development code
• Log4J was created for java and then gradually , the API was made for other languages
• Log4j has an inbuilt class called logger which is used to log information at run time

Log4j (Log for Java) is a popular open-source logging framework for Java applications, designed to facilitate effective and flexible logging. It addresses the need for systematic and organized logging of application events, making debugging and monitoring more efficient. Log4j offers a comprehensive set of features, including different log levels (such as DEBUG, INFO, WARN, ERROR), customizable output destinations (console, files, databases), and the ability to configure logging behavior dynamically without code changes.

With Log4j, developers can create loggers in their code to categorize log messages based on different components or areas of the application. Configuration can be managed through configuration files, allowing developers to adjust logging settings without altering the codebase. Additionally, Log4j provides powerful filtering capabilities, enabling selective logging based on specific criteria, which can be crucial for analyzing complex applications and identifying issues in a timely manner. Its versatility, ease of use, and widespread adoption make Log4j an essential tool for Java developers aiming to implement structured and efficient logging practices in their applications.

Software QA testing training, Java Training, HP UFT training, HP QTP training, Mobile apps testing training, Webservices testing training, SoapUI Testing training, Java, J2EE, ISTQB, BigData training, Informatica training and many other technologies are having lot of job opportunities.

H2KInfosys is passionate about educating people in IT and assisting them in jobs placement.

Subscribe our channel for latest updates

H2KInfosys is an E-Verify Employer based in Atlanta, GA USA providing world class services in IT Training, Software testing services, IT staffing solutions.

USA: +1-770-777-1269

#java, #JavaTutorial #JavaTutorialForBeginners #LearnJava #JavaOnlineTraining #JavaProgramming #javaonlinetutorial #javaprogrammingonline #javaonlinecourse
#learnjavaonline #javacoursesonlinefree #javacertificationtraining
#javaonlinetraining #bestonlinejavacourse #freedemoonlinejavaclasses #bestonlinejavacourses #javafullstackdevelopercourse
#javascriptdeveloper #javaprogrammer
#javacode #javascript30 #javascriptdevelopers
#javadeveloper #javaprogramming
#java #javasparrow #JavaTraining
#JavaSkills #JavaCourseTraining
#OnlineJavaTraining #javacourseonline
#javacourse #javatraining

H2kinfosys Online Training and Certifications:

Рекомендации по теме
Комментарии
Автор

Thanks for sharing the very useful video, Facing issue while implementing Log4j as part of Framework.
Hoping you will assist on the same.


Please find the the error faced while executing 2 test cases(TC01, TC02) which extends to Testbase from another package...


TestBase.java:


package logUtility;

import org.apache.log4j.Logger;
import
import
import

public class TestBase
{
public Logger logger;

@BeforeSuite
public void setup()
{
logger =


execution
}

@AfterSuite
public void tearDown()
{
execution
}
}



TC01.java:


package testCases;

import org.testng.annotations.Test;
import logUtility.TestBase;

public class TC01 extends TestBase {
@Test(priority = 1)
public void m1() {
logger.info("-TC01: m1 started");
logger.info("-TC01: m1 ended");
}

@Test(priority = 2)
public void m2() {
logger.info("-TC01: m2 started");
logger.info("-TC01: m2 ended");
}

@Test(priority = 3)
public void m3() {
logger.info("-TC01: m3 started");
logger.info("-TC01: m3 ended");
}

}



TC02.java:


package testCases;

import org.testng.annotations.Test;

import logUtility.TestBase;

public class TC02 extends TestBase {
@Test(priority = 1)
public void m1() {
logger.info("-TC02: m1 started");
logger.info("-TC02: m1 ended");
}

@Test(priority = 2)
public void m2() {
logger.info("-TC02: m2 started");
logger.info("-TC02: m2 ended");
}

@Test(priority = 3)
public void m3() {
logger.info("-TC02: m3 started");
logger.info("-TC02: m3 ended");
}

}







Output at the Console:


[RemoteTestNG] detected TestNG version 6.8.0
[TestNG] Running:


INFO [main] (TestBase.java:18)- ****Suite execution started****
INFO [main] (TC02.java:10)- -TC02: m1 started
INFO [main] (TC02.java:11)- -TC02: m1 ended
INFO [main] (TC02.java:16)- -TC02: m2 started
INFO [main] (TC02.java:17)- -TC02: m2 ended
INFO [main] (TC02.java:22)- -TC02: m3 started
INFO [main] (TC02.java:23)- -TC02: m3 ended
INFO [main] (TestBase.java:24)- ****Suite execution ended****



My query:


None of the methods from the TC01.java class are passing, Instead of getting Null Pointer Exception.


Please guide...

tejkumarkempaiah