log4j dailyrolling: Masking The specified packet log output

Source: Internet
Author: User
Tags log4j
Customer Requirements: log4j only the log content added in the program, masking any other log output.
Try to configure a bit of log4j.
1. Masks the log of spring components in the S2SH framework.
2. Masks the log of the Struts2 component in the S2SH framework.
3. Masks the log of Hibernate components in the S2SH framework.

The configuration is as follows:
Java code # # Disable Other log log4j.logger.org.springframework=off Log4j.logger.com.opensymphony.xwork2=off Log4j.lo Gger.org.hibernate=off

Start the program and discover that there is still a log output under the Struts2 component COM.OPENSYMPHONY.XWORK2 package.
Try multiple times, no fruit.
Check out the package structure of STRUTS2 and join Org.apache.struts2 to get it done.
The special records are configured as follows:
Java Code    ## root logger level [all,debug,info,warn,error,fatal,off]   log4j.rootlogger=debug,f_debug,f_info,f_warn,f_error   ## disable other log    log4j.logger.org.springframework=off   log4j.logger.org.apache.struts2=off   log4j.logger.com.opensymphony.xwork2=off   log4j.logger.com.ibatis=off   log4j.logger.org.hibernate=off      ## console appender   log4j.appender.console=org.apache.log4j.consoleappender   Log4j.appender.console.target=system.out    log4j.appender.console.layout=org.apache.log4j.patternlayout   log4j.appender.console.layout.conversionpattern=%d{yyyy-mm-dd hh:mm:ss,sss} [%-5p][%t] method:% l%n    %m%n      ## debug   log4j.appender.f_debug= org.apache.log4j.dailyrollingfileappender   Log4j.appender.F_DEBUG. Threshold=debug   log4j.appender.f_debug.file=logs/debug/debug.log   Log4j.appender.F_DEBUG. Datepattern= ' _ ' yyyy-mm-dd '. Log '    Log4j.appender.F_DEBUG. encoding=utf-8   log4j.appender.f_debug.layout=org.apache.log4j.patternlayout   Log4j.appender.f_debug.layout.conversionpattern=%d{yyyy-mm-dd hh\:mm\:ss,sss} [%-5p][%t] method \:%l%n    %m%n       ## info   log4j.appender.F_INFO= org.apache.log4j.dailyrollingfileappender   Log4j.appender.F_INFO. threshold=info   log4j.appender.f_info.file=logs/info/info.log   Log4j.appender.F_INFO. Datepattern= ' _ ' yyyy-mm-dd '. Log '    Log4j.appender.F_INFO. encoding=utf-8   log4j.appender.f_info.layout=org.apache.log4j.patternlayout   Log4j.appender.f_info.layout.conversionpattern=%d{yyyy-mm-dd hh\:mm\:ss,sss} [%-5p][%t] method\ :%L%N    %M%N &Nbsp;     ## warn   Log4j.appender.f_warn=org.apache.log4j.dailyrollingfileappender    Log4j.appender.F_WARN. threshold=warn   log4j.appender.f_warn.file=logs/warn/warn.log   Log4j.appender.F_WARN. Datepattern= ' _ ' yyyy-mm-dd '. Log '    Log4j.appender.F_WARN. encoding=utf-8   log4j.appender.f_warn.layout=org.apache.log4j.patternlayout   Log4j.appender.f_warn.layout.conversionpattern=%d{yyyy-mm-dd hh\:mm\:ss,sss} [%-5p][%t] method\ :%l%n    %m%n       ## error   Log4j.appender.F_ERROR =org.apache.log4j.dailyrollingfileappender   Log4j.appender.F_ERROR. threshold=error   log4j.appender.f_error.file=logs/error/error.log   Log4j.appender.F_ERROR. Datepattern= ' _ ' yyyy-mm-dd '. Log '    Log4j.appender.F_ERROR. encoding=utf-8   log4j.appender.f_error.layout=org.apache.log4j.patternlayout   LOg4j.appender.f_error.layout.conversionpattern=%d{yyyy-mm-dd hh\:mm\:ss,sss} [%-5p][%t] method\ :%l%n    %m%n 

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.