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

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

Commit b03d7608931aa4a2ad0a6c486079781b154e5c2c in logging-log4j2's branch 
refs/heads/dependabot/maven/org.apache.maven.plugins-maven-scm-plugin-1.12.2 
from Piotr P. Karwasz
[ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=b03d760 ]

Provide a uniform Log4j 1.x message factory

This PR provides a factory method that decides the type of message
based on the runtime type of the logged object (cf. [LOG4J2-3080](
https://issues.apache.org/jira/browse/LOG4J2-3080)).

These are applied to both `maybeLog` and `forceLog`.

> 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.20.1#820001)

Reply via email to