[ 
https://issues.apache.org/jira/browse/LOG4J2-2749?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17148900#comment-17148900
 ] 

ASF subversion and git services commented on LOG4J2-2749:
---------------------------------------------------------

Commit 583df1af9b46ab537cd2a0e657276d814c26618c in logging-log4j2's branch 
refs/heads/release-2.x from Oleksii Khomchenko
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=583df1a ]

LOG4J2-2749 Jackson version upgrade to fix empty value handling in JsonLayout 
(#362)



> JsonLayout KeyValuePair should not log json key which has empty or blank value
> ------------------------------------------------------------------------------
>
>                 Key: LOG4J2-2749
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2749
>             Project: Log4j 2
>          Issue Type: New Feature
>          Components: Layouts
>    Affects Versions: 2.12.1
>            Reporter: Mahesh Gujale
>            Priority: Minor
>              Labels: features
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> JsonLayout configured with following 
> {quote}<Console name="APP_STAT" target="SYSTEM_OUT">
>          <JSONLayout objectMessageAsJsonObject="true" compact="true" 
> eventEol="true">
>               <KeyValuePair key="timestamp" 
> value="$${date:yyyy-MM-dd'T'HH:mm:ss.SSSZ}" />
>                  <KeyValuePair key="type" value="$${ctx:type:-}" />
>          </JSONLayout>
> </Console>
> {quote}
> Which  logs as below
> {quote}{ 
>  "thread":"http-nio-8080-exec-1",
>  "level":"INFO",
>  "loggerName":"com.xyz.logging.interceptor.LogApiInterceptor",
>  "message":"App Stat",
>  "endOfBatch":true,
>  "loggerFqcn":"org.apache.logging.log4j.spi.AbstractLogger",
>  "instant":{ 
>    "epochSecond":1577422969,
>    "nanoOfSecond":22000000
>  },
>  "threadId":26,
>  "threadPriority":5,
>  "timestamp":"2019-12-27T10:32:49.022+0530",
>  "type":"",
> }
> {quote}
>  If we do not put 'type' in MDC or ThreadContext then json contains blank or 
> empty key 'type'. If the key type is not put MDC or if its value is empty 
> string/blank then JsonLayout should not log the key type in json.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to