[jira] [Commented] (LOG4J2-3266) ${CTX :ThreadName} does not work

2021-12-24 Thread Carter Kozak (Jira)


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

Carter Kozak commented on LOG4J2-3266:
--

Not directly related to the reported problem, but you seem to be doing a 
context-map lookup for a ThreadName property – if that's set from 
{{java.lang.Thread.getName()}}, you may want to use {{${event:ThreadName}}} 
instead, which uses the thread name associated with the LogEvent itself (no 
interactions with the ThreadContext/MDC required).

> ${CTX :ThreadName} does not work  
> --
>
> Key: LOG4J2-3266
> URL: https://issues.apache.org/jira/browse/LOG4J2-3266
> Project: Log4j 2
>  Issue Type: Question
>  Components: API
>Affects Versions: 2.17.0
>Reporter: wangbaohua
>Priority: Minor
>
> ${CTX :ThreadName} does not work at 2.17.0, but works fine below 2.16.0  
> My configuration is as follows  :
> ---
> 
> 
> 
> 
>   
>   
>     
>     ${sys:logPath}
>     
>     50M
>     
>     %d\{-MM-dd HH:mm:ss,SSS} %-5.5p [%t] 
> %X\{codeline} -%m%n
>     
>     fatal
>     warn
>     debug
>     info
>     error
>     trace
>     
>     summary
>     10
>     ${LOG_HOME}/logs/log.error
>      name="Thread_file">${LOG_HOME}/logs/log.${ctx:ThreadName}
>     ${LOG_HOME}/logs/DLframe.log
>     ${LOG_HOME}/logs/log.kafka
>   
>   
>     
>       KAFKA0:9092
>       
>         \{"time":"%d{-MM-dd 
> HH:mm:ss}","App":"alarmEngine","hostName":"${env:HOSTNAME}","loggerName":"%c","line":"%L","level":"%p","thread":"%t","message":"%m"}
>         
>       
>       
>         
>       
>     
>     
>      filePattern="${LOG_HOME}/logs/log.error.%i">
>       
>                  
>       
>       
>         
>         
>       
>     
>     
>     
>       
>         
>            fileName="${Thread_file}" 
> filePattern="${LOG_HOME}/logs/log.${ctx:ThreadName}.%i" append="true">
>             
>             
>               
>             
>             
>             
>                onMismatch="NEUTRAL"/>
>                onMismatch="NEUTRAL"/>
>                onMismatch="NEUTRAL"/>
>                onMismatch="NEUTRAL"/>
>                onMismatch="NEUTRAL"/>
>                onMismatch="DENY"/>
>             
>           
>         
>       
>     
>     
>      filePattern="${LOG_HOME}/logs/DLframe.log.%i" append="true">
>       
>       
>         
>       
>       
>       
>         
>         
>         
>         
>         
>         
>       
>     
>     
>      filePattern="${LOG_HOME}/logs/log.kafka.%i" append="true">
>       
>       
>         
>       
>       
>       
>         
>         
>         
>         
>         
>         
>       
>     
>   
>   
>     
>      includeLocation="true">
>       
>       
>       
>     
>     
>      includeLocation="true">
>       
>     
>     
>     
>   
> 
> -



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


[jira] [Commented] (LOG4J2-3266) ${CTX :ThreadName} does not work

2021-12-24 Thread Volkan Yazici (Jira)


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

Volkan Yazici commented on LOG4J2-3266:
---

I guess you need to inline {{fileName="$\{Thread_file\}"}} as described 
[here|https://github.com/apache/logging-log4j2/blob/release-2.x/docs/2.17.0-interpolation.md].
 Let me know if this works for you.

> ${CTX :ThreadName} does not work  
> --
>
> Key: LOG4J2-3266
> URL: https://issues.apache.org/jira/browse/LOG4J2-3266
> Project: Log4j 2
>  Issue Type: Bug
>  Components: API
>Affects Versions: 2.17.0
>Reporter: wangbaohua
>Priority: Critical
>
> ${CTX :ThreadName} does not work at 2.17.0, but works fine below 2.16.0  
> My configuration is as follows  :
> ---
> 
> 
> 
> 
>   
>   
>     
>     ${sys:logPath}
>     
>     50M
>     
>     %d\{-MM-dd HH:mm:ss,SSS} %-5.5p [%t] 
> %X\{codeline} -%m%n
>     
>     fatal
>     warn
>     debug
>     info
>     error
>     trace
>     
>     summary
>     10
>     ${LOG_HOME}/logs/log.error
>      name="Thread_file">${LOG_HOME}/logs/log.${ctx:ThreadName}
>     ${LOG_HOME}/logs/DLframe.log
>     ${LOG_HOME}/logs/log.kafka
>   
>   
>     
>       KAFKA0:9092
>       
>         \{"time":"%d{-MM-dd 
> HH:mm:ss}","App":"alarmEngine","hostName":"${env:HOSTNAME}","loggerName":"%c","line":"%L","level":"%p","thread":"%t","message":"%m"}
>         
>       
>       
>         
>       
>     
>     
>      filePattern="${LOG_HOME}/logs/log.error.%i">
>       
>                  
>       
>       
>         
>         
>       
>     
>     
>     
>       
>         
>            fileName="${Thread_file}" 
> filePattern="${LOG_HOME}/logs/log.${ctx:ThreadName}.%i" append="true">
>             
>             
>               
>             
>             
>             
>                onMismatch="NEUTRAL"/>
>                onMismatch="NEUTRAL"/>
>                onMismatch="NEUTRAL"/>
>                onMismatch="NEUTRAL"/>
>                onMismatch="NEUTRAL"/>
>                onMismatch="DENY"/>
>             
>           
>         
>       
>     
>     
>      filePattern="${LOG_HOME}/logs/DLframe.log.%i" append="true">
>       
>       
>         
>       
>       
>       
>         
>         
>         
>         
>         
>         
>       
>     
>     
>      filePattern="${LOG_HOME}/logs/log.kafka.%i" append="true">
>       
>       
>         
>       
>       
>       
>         
>         
>         
>         
>         
>         
>       
>     
>   
>   
>     
>      includeLocation="true">
>       
>       
>       
>     
>     
>      includeLocation="true">
>       
>     
>     
>     
>   
> 
> -



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