(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