Thursday, 9 February 2017

[Log4j] Logging Pattern (로그 패턴)

Pattern Description Example
%p Logging Level (DEBUG, INFO,...) %-5p
%m Log Message
%d Logging Timestamp. It can use date format obeying a SimpleDateFormat rules.
Default. yyyy-MM-dd HH:mm:ss
%d{yyyy MMM dd HH:mm:ss, SSS}%d{HH:mm:ss, SSS}
%d{ISO8601}
%d{ABSOLUTE}
%d{DATE}
%d{UNIX_MILLIS}
%t Thread Name
%T Thread ID
%n New Line. It is dependent on OS platform.
Unix/Linux : LF
Windows : CR-LF
MacOS : CR
%c Category %c{n}
%C Class name. It display class full name including package name and cut package name off
ex) pe.dorbae.blog.Log4j
%C{1} : Log4j
%C{3} dorbae.blog.Log4j

%C{n}
%F File Name
%l Location information of the caller which generated the logging event
%L Caller Line Number
%M Method Name
%r Uptime (milliseconds)
%x Thread NDC(Nested Diagnostic Context)
%X Thread MDC(Mapped Diagnostic Context)
%u Random or a time-based UUID %u{RANDOM}
%u{TIME}

No comments:

Post a Comment