log4j Configuration to print only the debug information for the specified jar or package

Source: Internet
Author: User
Tags log4j

Sometimes it is necessary to print the debug information of the third party jar when checking the problem, if all jars are printed, the log file will be very large, this time can be configured log4j to print only the specified jar debug information or package, and output to a new file.

For example: I only printed here MyBatis below DataSource This package debug information to the Debug.log

Log4j.logger.org.apache.ibatis.datasource.pooled=debug, test1log4j.appender.test1= org.apache.log4j.dailyrollingfileappenderlog4j.appender.test1.file=${webapp.root}logs/ Debug.loglog4j.appender.test1.datepattern= '. ' yyyy-mm-ddlog4j.appender.test1.encoding = utf-8log4j.appender.test1.maxfilesize= 100mblog4j.appender.test1.maxbackupindex=10log4j.appender.test1.threshold =debug   log4j.appender.test1.layout=org.apache.log4j.patternlayoutlog4j.appender.test1.layout.conversionpattern=[%t][% -5p]%d{yyyy-mm-dd HH:mm:ss. SSS} [%c{1}.%m]-%m%n

log4j Configuration to print only the debug information for the specified jar or package

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.