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

Ralph Goers commented on LOG4J2-476:
------------------------------------

A) Use of EventLogger is not required.  Once a value is set in the 
ThreadContext it is available in every subsequent log event on that thread 
regardless of the specific logger used. The example I referenced shows a 
servlet filter setting the ThreadContext. The data set there is available to 
all loggers, not just the EventLogger.
B) Obtaining the hostname is not inexpensive and recalculating it on every 
logging event is not very efficient.
C) If you use the Log4j 2 bridges from SLF4J, Log4j 1.2, etc then the MDC value 
created with their API is passed to Log4j 2's ThreadContext. OTOH, if the 
servlet filter technique is used to set the ThreadContext values then the data 
will be available to the Log4j 2 loggers and appenders regardless of the 
logging API that was used.

Given that the currently documented method works, is more flexible and is far 
less expensive it is likely that this will be closed as won't fix.

> Add source host to log event for distributed logging
> ----------------------------------------------------
>
>                 Key: LOG4J2-476
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-476
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 2.0-beta9
>            Reporter: Tal Liron
>            Priority: Critical
>
> It's absolutely necessary to support this: when logging centrally, you *need* 
> to know from where the log message arrived. I've marked the issue as 
> critical, because log4j is not very useful without it in distributed 
> environments. If you don't know where the log message came from, it's close 
> to worthless.
> This applies at least to all classes that inherit from 
> AbstractDatabaseAppender, but I think the solution should be more generic: 
> developers might create their own appenders that would require this 
> information. It can be handled, I think, in the same way as 
> LogEvent.setIncludeLocation: allow all loggers to include this information if 
> configured to do so.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to