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

Volkan Yazici commented on LOG4J2-3655:
---------------------------------------

You can either use one of the existing 
[lookups|https://logging.apache.org/log4j/2.x/manual/lookups.html] (put the IP 
into an environment variable called {{IP}} and use {{${env:IP}}}, use 
{{${kubernetes.containerId}}} if you are running in a Kubernetes pod, etc.) or 
create your own lookup (see {{DateLookup}} class for inspiration).

> Set the ip variable in loggerContext
> ------------------------------------
>
>                 Key: LOG4J2-3655
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-3655
>             Project: Log4j 2
>          Issue Type: Question
>            Reporter: xuwenping
>            Priority: Major
>
> Hello, is it possible to get the server ip when the project is initialized, 
> and put the ip into the LoggerContext as a variable, thank you.
> In this case, the downstream can directly use the value of ${ip} in the 
> configuration file, similar to ${hostname}.
> I hope I can submit a pull request if I want, thanks!



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to