Excerpt from official documentation: that is, logger is a subclass of category, with more functions than the parent class
Logger is a subclass of category, i.e. it extends category. In the other words, a loggeris a category. Thus, all operations The can is performed on a category can is performed on a logger. Internally, whenever log4j is asked to produce a Category object, it'll instead produce a Logger object. LOG4J 1.2 willnever produce Category objects but Onlylogger instances. In order to preserve backward compatibility, methods this previously accepted category objects still continue to accept CA Tegory objects.
For example, the following is all legal and would work as expected.
Deprecated form:
Category cat = category.getinstance ("foo.bar")
//Preferred form for retrieving loggers:
Logger Logger = Logger.getlogger ("Foo.bar")
The first form is deprecated and should are avoided.
There is absolutely no need for new client code to use or refer to Thecategory class. Whenever possible, please avoid referring to it or using it.
Configure the root logger with the following syntax: 0
Log4j.rootlogger = [ level ] , Appendername, &nbs P Appendername, ...
where level is the priority of logging, divided into off, FATAL, ERROR, WARN, INFO, DEBUG, all, or custom levels. LOG4J recommends using only four levels, with the priority from high to low being error, WARN, INFO, DEBUG. By defining the level here, you can control the switch to the appropriate level of log information in your application. For example, if the info level is defined here, the log information for all debug levels in the application will not be printed. Appendername is where you specify where the log information is exported. Multiple output destinations can be specified at the same time.
Log4j.rootcategory=debug, stdout,r
That means I'm going to show all the priorities equal to and higher than DEBUG information.
in the log4j.properties file, "Log4j.rootcategory=debug,stdout,r" is rewritten as "Log4j.rootcategory=off, Stdout,r", This will not display all of the log information, and resolves the issues raised in this article.
in the log4j.properties file, "Log4j.rootcategory=debug,stdout,r" is rewritten as "log4j.rootcategory=info, Stdout,r", This displays only the log information for info, WARN, error, and debug information is not displayed;