Bug 56915 - PatternLayout - %c in ConversionPattern is not returning what is expected.
Summary: PatternLayout - %c in ConversionPattern is not returning what is expected.
Status: NEW
Alias: None
Product: Log4j - Now in Jira
Classification: Unclassified
Component: Layout (show other bugs)
Version: 1.2.17
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: log4j-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-09-04 22:59 UTC by kumi.hagimoto
Modified: 2014-09-04 22:59 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description kumi.hagimoto 2014-09-04 22:59:27 UTC
Using this pattern:
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n" />

==> result 

2014-09-04 15:42:51 DEBUG headers:116 - http-outgoing-1 << Connection: Keep-Alive
2014-09-04 15:42:51 DEBUG headers:116 - http-outgoing-1 << Content-Type: application/json; charset=utf-8


Just for comparison, I ran the same code with the following pattern (replacing %c{1} with %C:
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5p %C:%L - %m%n" />

==> result

2014-09-04 15:45:12 DEBUG org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 - http-outgoing-2 << Connection: Keep-Alive
2014-09-04 15:45:12 DEBUG org.apache.http.impl.conn.LoggingManagedHttpClientConnection:116 - http-outgoing-2 << Content-Type: application/json; charset=utf-8

"%c{1}" is not getting the right-most component as described in the documentation.

Please let me know if you need more info, or I'm doing something wrong!
Thanks,
Kumi