Get all updates of Java4s
Follow Us: Email Newsletter

What Is Log4j, Why Log4j Came Into Picture

Log4j » On Feb 27, 2012 { 35 Comments } By Sivateja

For logging log4j is the best even today, let us see little history behind this :-)

While developing Java/J2EE applications, for debugging an application that is to know the status of a java application at its execution time, in general we use system.out.println statements in the application right…

But we have some disadvantages while using SOPL (system.out.println) statements.

  • Generally SOPL statements are printed on console, so there are temporary messages and when ever the console is closed then automatically the messages are removed from the console
  • It is not possible to store the SOPL messages in a permanent place and these are single threaded model, means these will prints only one by one message on the console screen
  • In order to overcome the problems  of  SOPL statements Log4j came into picture, with Log4j we can store the flow details of  our Java/J2EE in a file or databases
  • This is a Open Source tool given by Apache, for only java projects, to record or write the status of an application at various places
  • Working with log4j is nothing but working with classes & interfaces given in org.apache.log4j.*
  • Log4j is a common tool, used for small to large scale Java/J2EE projects
  • In Log4j we use log statements rather SOPL statements in the code to know the status of a project while it is executing
  • In real time, after a project is released and it is installed in a client location then we call the location as on-site right, when executing the program at on-site location, if we got any problems occurred then these problems must report to the off showered engineers,  in this time we used to mail these Log files only so that they can check the problems easily


You Might Also Like

  ♦ About Author ♦

Full Stack( Java/J2EE & UI/UX ) Developer and founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog. Sign-up for the Email Newsletter for your daily dose of Java tutorials.


35 Responses to “What Is Log4j, Why Log4j Came Into Picture”
  1. veeru says:

    nice introduction by u………..

  2. swapna says:

    You explains in a very simple language and it is very well understood.

  3. @swapna you are true, the way the explanation is too good.

  4. kiran says:

    Can you [lease mail me log4j,json,jquery material

  5. Sir, your all the tutorial’s are Awesome…….

    if Possible, Please provide WEB Services tutorial…….


  6. rajender says:

    XmlLayout output is not a well formatted output

    how to genertaed a well formatted Xml through xmlLayout
    give complte files of Example

  7. chinnarego says:

    now only i understood for log4j…thanks sir……

  8. shubhada says:

    Nyc explanation to begin with log4j…thanks :)

  9. vilkas says:

    Your way of explanation is really super…

  10. krishna says:

    Excellent tutorial!!!! Thank you sir!!!!

  11. lakshmi narayana reddy says:

    Dear sivateja reddy.
    Really good job…………..

  12. suresh says:

    Very good…explanation, nice..Thank you.

  13. Gopinath says:

    i understood, why log4j come in to picture….
    thank u sir …..

  14. Durga says:

    hi ,
    very good introduction about log4j

  15. bhaskara says:

    very nice explanation thanks ,till now i didn’t got thought about log4j.

  16. prayas says:

    to the point explanation !!

  17. krishna says:

    Hi ,
    Siva Teja, its great tutorial i have never seen , could you please provide same
    for spring MVC tutorial with maven project structure , because i have referred lot of tutorial for maven with spring MVC ,no where i found exact solution like java4s so please give at least one example with maven project structure

    Thanks & Regards,
    Krishna Arigela.

  18. shobha says:

    Too good explanation…

  19. Ashok Katherla says:

    Unbelievable this is very nice explanation…

  20. Nageswara Rao says:

    superb thank u yar

  21. Trupti says:


  22. Atul says:

    nice explanation…. thanks a lot..

  23. sreekar says:

    Your nice explanation

  24. surjit kumar says:

    You explained in very simple words and sentences.Now I have understood .Thanks sir

  25. Ranjit says:


    It’s a very nice explanation..
    Each and every thing of this tutorial is matching to the real scenario..
    Great job..

  26. bharath says:

    Your explanation is very quite simple and understandable….Thank you for the assistance.

  27. swati says:

    You Explained very well.

  28. Udaya says:

    Excellent and Simple way of Explanation,
    Thank you

  29. subbarao popuri says:

    Siva Teja Ur site very useful for beginers :)

  30. shaneshwar says:

    it’s very simple to understand

  31. Anjan says:

    Nice Explanation…..

  32. sudhir says:

    I am happy because eaisly understand

  33. Purnachander says:

    it’s very easy to understand and thank you!

  34. kumar says:

    I happy to vist this web site…
    esly undestanble by every one thank u very much……


By posting your answer, you agree to our comments policy.
What would you like to learn today?
Browse these popular technologies
Hibernate spring struts Servlets ajax Log4j jQuery Json Core Java Web Services AngularJs
Most Recent Tutorials
Hibernate_Logo Hibernate Recent Posts Spring_Logo Spring Recent Posts Struts_Logo Struts Recent Posts
Useful Links Current & UpComing Tutorials
  Web Services [ SOAP ], JSP
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2016 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.