• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

what is the use of setting levels in log4j

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i m very new to log4j. what is the use of setting levels in log4j.
debug,warn,info.what is the difference between this.

plz help me to know this thiongs
 
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Anitha India",

Welcome to JavaRanch. We don't have many rules here, but we do have a naming policy which we try to follow very closely. Please re-read this policy and edit your display name in order to comply.

Regarding your question, this is the Struts forum and is not really an appropriate place to get this question answered. Moved to Other Open Source Projects forum where you're more likely to receive the answer you're looking for.
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

what is the use of setting levels in log4j.
debug,warn,info.what is the difference between this.


The logging levels are used for filtering log messages based on importance. For example, to aid debugging people add logging statements around their code so that they can later on analyze the log to see what happened right before the system crashed or right before a user got a mysterious error message, etc.

Now, you might have thousands of these logging statements all around your code, with each user action effectively causing dozens of statements being executed. If you keep your logging level on DEBUG, all of these dozens, even hundreds of statements will be written to the log file, which takes up a lot of resources both in terms of file I/O and diskspace.

What people typically do is to set the logging level to INFO in a production environment. This effectively means that all debug-level statements are filtered out and will not be written anywhere, thus saving resources and improving the system's performance, while all messages on level INFO, WARN, ERROR and FATAL will still get written to the log file -- it's just the DEBUG stuff that we wanted to get rid of.

Now, you might consider those INFO messages to be rather useless as well and also taking up a lot of disk so you switch the logging level up another notch, to WARN, meaning that now everything below WARN will get filtered out and you'll only get WARN, ERROR and FATAL messages into your log file.

Did that answer your question?


PS. your display name is still not quite in compliance -- the policy requires a first name and a last name, or at least an initial for the first name. Could you fix that, again? Thanks.
 
Where all the women are strong, all the men are good looking and all the tiny ads are above average:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic