For a large system, especially a high-volume web system, it is not easy to check for important error or fatal information in a log file that records a vast amount of info, even debug log information, even if you use grep, which is quite passive. If we can configure a different file Appender for the same logger to record all the information (generally on-line system is info level), another problem that only records the error above is solved. Log4j have such control properties, not common, but there are ^_^:
Log4j.appender.errorfileout.Threshold = ERROR
XML format configuration (placed in the appender tag): <param name= "Threshold" value= "ERROR"/>
In this way, the error and fatal level information is recorded in the Errorfileout Appender. A more complete example of a configuration file is given below:
Log4j.rootlogger=debug,stdout
Log4j.logger.net.dxtop=debug,fileout,errorfileout
#log4j. Additivity.net.dxtop=false
If you do not want the error and fatal to be put together, you can refer to the reference document listed later in this article, for most people, the above configuration method is sufficient.
Another less common attribute, additivity, is also useful, see the file above: #log4j. additivity.net.dxtop=false
If the value is false, the information output by net.dxtop This logger Appender is not written to the Appender of its parent logger.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.