[
https://issues.apache.org/jira/browse/LOG4J2-2641?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16871759#comment-16871759
]
Peter Podniesinski commented on LOG4J2-2641:
--------------------------------------------
I suppose my use-case is specific to our integration with ELK. I do want log4j
to merge a message and a JSON request object for me, but for them to be
seperate attributes (similar to how log level is a seperate attribute in the
logEvent).
So in pseudo code really simply like
{code:java}
logger.info({'request': payload, 'message': 'here is my application
message'});{code}
And it would be nice if I could do this without creating a custom Logger Object
to store those two attributes.
I was investigating using Marker, but I'm not sure if that is the correct
approach.
> How to Log object entries outside the message entry
> ---------------------------------------------------
>
> Key: LOG4J2-2641
> URL: https://issues.apache.org/jira/browse/LOG4J2-2641
> Project: Log4j 2
> Issue Type: Question
> Reporter: Peter Podniesinski
> Priority: Trivial
>
> Hi Team. I could use some advice how to craft a log statement that prints
> both a String Message along with a request json details.
> If I do something like this it gets stringified and shows up in the
> `_message_` field in Logstash.
> {code:java}
> logger.info("Create Account Application. Request: {}",
> gson.toJson(depositApplicationRequest));`{code}
>
>
> Ideally I want this to show up looking like:
>
> {code:java}
> { request: ...,
> message: 'Create Account Application' }{code}
>
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)