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.