%c{precision}, %logger{precision} |
Logger name |
%d, %date |
Note: Only the predefined date formats are garbage-free: (millisecond
separator may be either a comma ',' or a period '.')
Pattern |
Example |
%d{DEFAULT} |
2012-11-02 14:34:02,781 |
%d{ISO8601} |
2012-11-02T14:34:02,781 |
%d{ISO8601_BASIC} |
20121102T143402,781 |
%d{ABSOLUTE} |
14:34:02,781 |
%d{DATE} |
02 Nov 2012 14:34:02,781 |
%d{COMPACT} |
20121102143402781 |
%d{HH:mm:ss,SSS} |
14:34:02,781 |
%d{dd MMM yyyy HH:mm:ss,SSS} |
02 Nov 2012 14:34:02,781 |
%d{HH:mm:ss}{GMT+0} |
18:34:02 |
%d{UNIX} |
1351866842 |
%d{UNIX_MILLIS} |
1351866842781 |
|
%enc{pattern}, %encode{pattern} |
Encodes special characters such as
'\n' and HTML characters to help prevent log forging and some XSS
attacks that could occur when displaying logs in a web browser -
garbage-free since 2.8 |
%equals{pattern}{test}{substitution},
%equalsIgnoreCase{pattern}{test}{substitution} |
Replaces occurrences
of 'test', a string, with its replacement 'substitution' in the string
resulting from evaluation of the pattern - garbage-free since 2.8 |
%highlight{pattern}{style} |
Adds ANSI colors - garbage-free since 2.7
(unless nested pattern is not garbage free) |
%K{key}, %map{key}, %MAP{key} |
Outputs the entries in a
MapMessage,
if one is present in the event - garbage-free since 2.8. |
%m, %msg, %message |
Log message (garbage-free unless message text
contains '${') |
%marker |
The full name of the marker (including parents) - garbage-free
since 2.8 |
%markerSimpleName |
The simple name of the marker (not including
parents) |
%maxLen, %maxLength |
Truncates another pattern to some max number of
characters - garbage-free since 2.8 |
%n |
The platform dependent line separator |
%N, %nano |
System.nanoTime() when the event was logged |
%notEmpty{pattern}, %varsNotEmpty{pattern},
%variablesNotEmpty{pattern} |
Outputs the result of evaluating the
pattern if and only if all variables in the pattern are not empty -
garbage-free since 2.8 |
%p, %level |
The level of the logging event |
%r, %relative |
The number of milliseconds elapsed since the JVM was
started until the creation of the logging event - garbage-free since 2.8 |
%sn, %sequenceNumber |
A sequence number that will be incremented in
every event - garbage-free since 2.8 |
%style{pattern}{ANSI style} |
Style the message - garbage-free since
2.7 (unless nested pattern is not garbage free) |
%T, %tid, %threadId |
The ID of the thread that generated the logging
event |
%t, %tn, %thread, %threadName |
The name of the thread that generated
the logging event |
%tp |
The priority of the thread that generated the logging event |
%X{key[,key2…]}, %mdc{key[,key2…]}, %MDC{key[,key2…]} |
Outputs
the Thread Context Map (also known as the Mapped Diagnostic Context or
MDC) associated with the thread that generated the logging event -
garbage-free since 2.8 |
literal text |
Garbage-free unless literal contains '${' (variable
substitution) |