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

Gary D. Gregory edited comment on LOG4J2-3391 at 2/8/22, 2:16 AM:
------------------------------------------------------------------

[~ugurlu] 

Please test git master or a 2.17.2-SNAPSHOT build.

Example configuration:
{code:xml}
<Configuration status="WARN">
  <Appenders>
    <NoSql name="MongoDbAppender">
      <MongoDb4 
connection="mongodb://localhost:${sys:MongoDBTestPort:-27017}/testDb.testCollection"
 />
      <KeyValuePair key="A" value="1" />
      <KeyValuePair key="B" value="2" />
      <KeyValuePair key="env1" value="${env:PATH}" />
      <KeyValuePair key="env2" value="$${env:PATH}" />
    </NoSql>
  </Appenders>
  <Loggers>
    <Root level="ALL">
      <AppenderRef ref="MongoDbAppender" />
    </Root>
  </Loggers>
</Configuration>
{code}
The above works and is tested with the {{log4j-mongodb3}} and 
{{log4j-mongodb4}} modules.


was (Author: garydgregory):
[~ugurlu] 

Please test git master or a 2.17.2-SNAPSHOT build.

Example configuration:
{code:xml}
<Configuration status="WARN">
  <Appenders>
    <NoSql name="MongoDbAppender">
      <MongoDb4 
connection="mongodb://localhost:${sys:MongoDBTestPort:-27017}/testDb.testCollection"
 />
      <KeyValuePair key="A" value="1" />
      <KeyValuePair key="B" value="2" />
      <KeyValuePair key="env1" value="${env:PATH}" />
      <KeyValuePair key="env2" value="$${env:PATH}" />
    </NoSql>
  </Appenders>
  <Loggers>
    <Root level="ALL">
      <AppenderRef ref="MongoDbAppender" />
    </Root>
  </Loggers>
</Configuration>
{code}

> Add optional additional fields to NoSQLAppender
> -----------------------------------------------
>
>                 Key: LOG4J2-3391
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3391
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Appenders
>            Reporter: Omer U
>            Assignee: Gary D. Gregory
>            Priority: Major
>             Fix For: 2.17.2
>
>
> Additional fields cannot be added to NoSQLAppender logs. 
> I wasn't able to way a find of attaching fields application server hostname 
> or a simple tag like application server name.
> Only way of adding custom information seems to be ThreadContext



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to