This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Log4J - Basics

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am new to Log4J. While searching over net I got the below doubts.

1) Why there are multiple levels in log4j, I mean DEBUG, INFO etc? When I need to a specific one?
2) Consider INFO is for information, if any of my code wher I need to use logger.info(). But I used logger.debug().So system will throw any exception?
3) what is log4j.properties file? explain the code inside that
4) how to configure log4j with tomcat. how to switch on or off??


Please clarify my doubts.

Thanks & Regards,
Ravi.
 
author
Posts: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Chinna Ravindra wrote:Hi All,

I am new to Log4J. While searching over net I got the below doubts.

1) Why there are multiple levels in log4j, I mean DEBUG, INFO etc? When I need to a specific one?
2) Consider INFO is for information, if any of my code wher I need to use logger.info(). But I used logger.debug().So system will throw any exception?
3) what is log4j.properties file? explain the code inside that
4) how to configure log4j with tomcat. how to switch on or off??

Please clarify my doubts.

Thanks & Regards,
Ravi.



1.) So you can filter out on those levels, for example in a production log you might only want to see ERROR and WARN, but not INFO and DEBUG
2.) DEBUG is used for verbose information aimed at developers, INFO is more of System administrator level of information (this is my opinion)
3.) log4j.properties is what you use to configure log4j, please see their website for details (and consider using the more flexible log4j.xml)
4.) This depends (per application basis)
 
Bhairava Surya
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
You can't expect to wield supreme executive power just because
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!