[JAVA] JAVA log4j Level setting


Log4j records logs divided into 7 levels of Event Level
Depending on the config level setting, the log can be set as follows!!
 

FATAL > ERROR > WARN > INFO > DEBUG > TRACE

TRACE -> Specify more granular information than DEBUG

DEBUG -> Specify information for debugging programs
INFO -> Specifying informational messages such as status changes
WARN -> Specify a workable issue, warning message that may cause future system errors
ERROR -> If there is a problem processing your request
FATAL -> Serious error that may interrupt the program, if it is inoperable

When carrying out the project, the development guide is generally required to print out four types of DEBUG, INFO, WARN, and ERROR separately!!

Pattern Options
%m: Output log content
%p: debug, info, warn, error, fatal sort of priority print
%r: Outputs in milliseconds after application starts until event occurs
%c: package output
%c{n}: Outputs n (numeric) packages from bottom to reverse
e.g.) When %c{2} the a.b.c is output as b.c.
%n: Output of opening characters. \r\n or \n output depending on the platform.
%d: Output of the date of occurrence of the event (slows the execution of the program).)
e.g.) %d{HH:mm:ss} or %d{dd MMMM yyyy HH:mm:ss}
%C: Caller's Class Name Output
e.g.) When %C{2} the a.b.c.TestClass is c.It is output to TestClass.
%M: method name.
%F: Program filename.
%l:About Caller
%L: Number of lines in the caller
%x: related with thread NDC(nested diagnostic context)
%X: related with thread MDC(mapped diagnostic context)
%%: Output % mark
%t: thread name

😀
Thank you !!
고마워 !!

Comments