You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Volkan Yazici (Jira)" <ji...@apache.org> on 2021/06/07 07:34:00 UTC

[jira] [Updated] (LOG4J2-3080) Messages logged inconsistently when using JsonTemplateLayout.

     [ https://issues.apache.org/jira/browse/LOG4J2-3080?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Volkan Yazici updated LOG4J2-3080:
----------------------------------
    Fix Version/s: 3.0.0

> Messages logged inconsistently when using JsonTemplateLayout.
> -------------------------------------------------------------
>
>                 Key: LOG4J2-3080
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3080
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: JsonTemplateLayout
>    Affects Versions: 2.14.1
>            Reporter: Schubert Fernandes
>            Assignee: Volkan Yazici
>            Priority: Major
>             Fix For: 3.0.0, 2.15.0
>
>         Attachments: log4j.json.event.layout.zip
>
>
> When using the JsonTemplateLayout and configuring the message with a fallbackKey...
> {code:json}
>   "message": {
>     "$resolver": "message",
>     "fallbackKey": "asString"
>   }
> {code}
> the fallbackKey is not consistently used.
> When logging via _org.apache.log4j.Category.info(Object)_ the message string is logged directly without using the property defined in _fallbackKey_, e.g. 
> {panel}
> {"timestamp":"2021-04-21T14:25:27.625+01:00","loggerName":"explore.log4j.json.template.layout.Main","level":"INFO","{color:red}message":"Message logged using org.apache.log4j.Category.info(Object)"}{color}
> {panel}
> but when logging using _org.apache.logging.log4j.Logger.info(String)_ the message is correctly logged in the _asString_ property as required, i.e.
> {panel}
> {"timestamp":"2021-04-21T14:25:27.628+01:00","loggerName":"explore.log4j.json.template.layout.Main","level":"INFO","{color:green}message":{*"asString"*:"Message logged using org.apache.logging.log4j.Logger.info(String)"}}{color}
> {panel}
> Sample Maven project attached to reproduce.



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