Bug 56340 - EnhancedPatternLayout layout could be improved
Summary: EnhancedPatternLayout layout could be improved
Status: NEW
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Layout (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: ---
Assignee: log4j-dev
URL: http://logging.apache.org/log4j/1.2/a...
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-02 15:12 UTC by Greg Bishop
Modified: 2014-04-02 15:14 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Bishop 2014-04-02 15:12:08 UTC
%c
greg.AsynchronysFoxtrotExample

BUG:

The ~ separator takes up just as much space as the actual text.

%c{3~.2~.1~.}

   gre~.AsynchronysFoxtrotExample   
That's silly, it should be:  
   greg.AsynchronysFoxtrotExample

BUG:

If the . is left off it would be nice if the ~ replaced the . like so:

%c{3~} //Does not work, the docs say it should

Desired:
gre~AsynchronysFoxtrotExample
gre~fff~ddd~ccc~bbb~aaa~AsynchronysFoxtrotExample
Actual:
gre~.AsynchronysFoxtrotExample
gre~.fff~.ddd~.ccc~.bbb~.aaa~.AsynchronysFoxtrotExample

http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/EnhancedPatternLayout.html

"%logger{1~.2~} will output the first character of the first element, two characters of the second AND SUBSEQUENT ELEMENTS AND WILL USE A TILDE TO INDICATE ABBREVIATED CHARACTERS." (Emphasis mine)