Skip to content
This repository was archived by the owner on Sep 13, 2023. It is now read-only.

Commit 0356b92

Browse files
committed
added some docs only present in extras
git-svn-id: https://svn.apache.org/repos/asf/logging/log4j/trunk@1481781 13f79535-47bb-0310-9956-ffa450edef68
1 parent d8692f2 commit 0356b92

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

src/main/java/org/apache/log4j/EnhancedPatternLayout.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,15 @@ <p>Used to output the MDC (mapped diagnostic context) associated
309309
310310
<p>By default the relevant information is output as is. However,
311311
with the aid of format modifiers it is possible to change the
312-
minimum field width, the maximum field width and justification.
312+
minimum field width, the maximum field width, justification
313+
and truncation.
313314
314-
<p>The optional format modifier is placed between the percent sign
315+
<p>The optional format modifier are placed between the percent sign
315316
and the conversion character.
316317
317-
<p>The first optional format modifier is the <em>left justification
318-
flag</em> which is just the minus (-) character. Then comes the
318+
<p>The <em>left justification flag</em>, the minus sign (-),
319+
the <em>right truncation flag</em>, the exclamation mark (!),
320+
or any combination appear first. Followed by the
319321
optional <em>minimum field width</em> modifier. This is a decimal
320322
constant that represents the minimum number of characters to
321323
output. If the data item requires fewer characters, it is padded on
@@ -334,7 +336,8 @@ reached. The default is to pad on the left (right justify) but you
334336
example, it the maximum field width is eight and the data item is
335337
ten characters long, then the first two characters of the data item
336338
are dropped. This behavior deviates from the printf function in C
337-
where truncation is done from the end.
339+
where truncation is done from the end. The <em>right truncation flag</em>,
340+
described previously, will override this behavior.
338341
339342
<p>Below are various format modifier examples for the category
340343
conversion specifier.
@@ -369,6 +372,15 @@ reached. The default is to pad on the left (right justify) but you
369372
<td>Truncate from the beginning if the category name is longer than 30
370373
characters.
371374
375+
<tr>
376+
<td align=center>%!.30c</td>
377+
<td align=center>NA</td>
378+
<td align=center>none</td>
379+
<td align=center>30</td>
380+
381+
<td>Truncate from the end if the category name is longer than 30
382+
characters.
383+
372384
<tr>
373385
<td align=center>%20.30c</td>
374386
<td align=center>false</td>

0 commit comments

Comments
 (0)