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

DarkGoofy updated LOG4J2-3460:
------------------------------
    Description: 
When we upgraded our Spring to use log4j 2.17.1 the structured logs no longer 
contained any structured fields we added to the log statement.

I am logging several structured arguments as follows

 
{code:java}
log.info("Get container",
                v("TENANT_ID", tenantId),
                v("CONTAINER_ID", containerId)){code}
 

NOTE: That class is instrumented with@Log4j2 (lombok)

but not seeing the arguments in the JSON in the log file
{code:java}
{
  "ts":"2022-02-02T18:22:21.312Z",
  "level":"INFO",
  "msg":"Get container"
} {code}
 

logback-spring.xml

 
{code:java}
logback-spring.xml<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <contextName>Signal Service</contextName>
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <encoder 
class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
            <providers>
                <timestamp>
                    <fieldName>ts</fieldName>
                    <timeZone>UTC</timeZone>
                </timestamp>
                <logLevel>
                    <fieldName>level</fieldName>
                </logLevel>
                <mdc/>
                <arguments>
                    
<includeNonStructuredArguments>false</includeNonStructuredArguments>
                </arguments>
                <stackTrace>
                    <fieldName>stack</fieldName>
                </stackTrace>
                <message>
                    <fieldName>msg</fieldName>
                </message>
            </providers>
        </encoder>
    </appender>
    <root level="INFO">
        <appender-ref ref="CONSOLE"/>
    </root>
</configuration> {code}
 

 

 

This issue is linked with the commit : 
[https://github.com/apache/logging-log4j2/commit/487588b7c34bc0b540e769d98c42d018fa1bc1b8]

!LOG4J2-3460.png!

 

Why the parameters (message.getParameters()) is not propaged (the null value is 
propaged) ?

 

 

 

  was:
When we upgraded our Spring to use log4j 2.17.1 the structured logs no longer 
contained any structured fields we added to the log statement.

I am logging several structured arguments as follows

 
{code:java}
log.info("Get container",
                v("TENANT_ID", tenantId),
                v("CONTAINER_ID", containerId)){code}
 

NOTE: That class is instrumented with@Log4j2 (lombok)

but not seeing the arguments in the JSON in the log file
{code:java}
{
  "app":"Signal Service",
  "ts":"2022-02-02T18:22:21.312Z",
  "level":"INFO",
  "class":"com.tbd.platform.signal.controller.ContainerController",
  "method":"getContainer",
  "caller_file_name":"ContainerController.java",
  "line":153,"thread":"http-nio-8080-exec-2", 
  "msg":"Get container"
} {code}
 

logback-spring.xml

 
{code:java}
logback-spring.xml<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <contextName>Signal Service</contextName>
    <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
        <encoder 
class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
            <providers>
                <timestamp>
                    <fieldName>ts</fieldName>
                    <timeZone>UTC</timeZone>
                </timestamp>
                <logLevel>
                    <fieldName>level</fieldName>
                </logLevel>
                <mdc/>
                <arguments>
                    
<includeNonStructuredArguments>false</includeNonStructuredArguments>
                </arguments>
                <stackTrace>
                    <fieldName>stack</fieldName>
                </stackTrace>
                <message>
                    <fieldName>msg</fieldName>
                </message>
            </providers>
        </encoder>
    </appender>
    <root level="INFO">
        <appender-ref ref="CONSOLE"/>
    </root>
</configuration> {code}
 

 

 

This issue is linked with the commit : 
[https://github.com/apache/logging-log4j2/commit/487588b7c34bc0b540e769d98c42d018fa1bc1b8]

!LOG4J2-3460.png!

 

Why the parameters (message.getParameters()) is not propaged (the null value is 
propaged) ?

 

 

 


> Structured fields are no longer printed when using log4j 2.17.1
> ---------------------------------------------------------------
>
>                 Key: LOG4J2-3460
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3460
>             Project: Log4j 2
>          Issue Type: Bug
>          Components: Log4j-to-SLF4J
>    Affects Versions: 2.17.1
>            Reporter: DarkGoofy
>            Priority: Critical
>         Attachments: LOG4J2-3460.png
>
>
> When we upgraded our Spring to use log4j 2.17.1 the structured logs no longer 
> contained any structured fields we added to the log statement.
> I am logging several structured arguments as follows
>  
> {code:java}
> log.info("Get container",
>                 v("TENANT_ID", tenantId),
>                 v("CONTAINER_ID", containerId)){code}
>  
> NOTE: That class is instrumented with@Log4j2 (lombok)
> but not seeing the arguments in the JSON in the log file
> {code:java}
> {
>   "ts":"2022-02-02T18:22:21.312Z",
>   "level":"INFO",
>   "msg":"Get container"
> } {code}
>  
> logback-spring.xml
>  
> {code:java}
> logback-spring.xml<?xml version="1.0" encoding="UTF-8"?>
> <configuration>
>     <contextName>Signal Service</contextName>
>     <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
>         <encoder 
> class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
>             <providers>
>                 <timestamp>
>                     <fieldName>ts</fieldName>
>                     <timeZone>UTC</timeZone>
>                 </timestamp>
>                 <logLevel>
>                     <fieldName>level</fieldName>
>                 </logLevel>
>                 <mdc/>
>                 <arguments>
>                     
> <includeNonStructuredArguments>false</includeNonStructuredArguments>
>                 </arguments>
>                 <stackTrace>
>                     <fieldName>stack</fieldName>
>                 </stackTrace>
>                 <message>
>                     <fieldName>msg</fieldName>
>                 </message>
>             </providers>
>         </encoder>
>     </appender>
>     <root level="INFO">
>         <appender-ref ref="CONSOLE"/>
>     </root>
> </configuration> {code}
>  
>  
>  
> This issue is linked with the commit : 
> [https://github.com/apache/logging-log4j2/commit/487588b7c34bc0b540e769d98c42d018fa1bc1b8]
> !LOG4J2-3460.png!
>  
> Why the parameters (message.getParameters()) is not propaged (the null value 
> is propaged) ?
>  
>  
>  



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

Reply via email to