Log4j xml configuration details

Source: Internet
Author: User

(1). There are generally five appender output methods:

Org. Apache. log4j. rollingfileappender (rolling file, automatically record the latest log)
Org. Apache. log4j. leleappender (console)
Org. Apache. log4j. fileappender (file)
Org. Apache. log4j. dailyrollingfileappender (a log file is generated every day)
Org. Apache. log4j. writerappender (send log information to any specified place in stream format)

(2) The priority of the diary record, which is divided from high to low.
Off, fatal, error, warn, info, debug, all.
We recommend that you use only fatal, error, warn, info, and debug levels for log4j.

(3). The format indicates that parameters in layout start with %, and the following parameters represent different formatting information (parameters are listed in alphabetical order ):
% C indicates the full name of the output class, which can be changed to the dimension output by % d {num} And num Class Name (for example, "org. apache. elattings. classname ", % c {2} Will output elattings. classname)
% D: the log output time is in the format of % d {yyyy-mm-dd hh: mm: SS, SSS}. You can specify the format, for example, % d {hh: mm: SS}
% L location of log event output, including category name and thread Code Number of rows in
% N line break
% M output code specified information, such as Info ("message"), Output Message
% P output priority, namely, fatal, error, etc.
% R the number of milliseconds it takes to output the log information from startup to display.
% T name of the thread that outputs the log event

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.