logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: MDC/NDC copy or original?
Date Mon, 06 Aug 2012 06:21:39 GMT
I'm confused. Although the javadoc could be better http://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/ThreadContext.html#getContext()
and http://logging.apache.org/log4j/2.x/log4j-api/apidocs/org/apache/logging/log4j/ThreadContext.html#getContext()
both say they return a copy.  ThreadContext doesn't have methods named getContextMap or getContextStack.

Note that the LogEvent is not available in the API.

Ralph

On Aug 5, 2012, at 10:45 PM, Scott Deboy wrote:

> My point was really the contract in the API javadoc should be updated and we should implement
that contract..if we neeed new APIs, that's ok..or if I'm forced to create a new Log4jevent
I'll deal with the contract.
> 
> Scott
> 
> On Sun, Aug 5, 2012 at 9:32 PM, Ralph Goers <ralph.goers@dslextreme.com> wrote:
> In the Log4j 2 API the getContext and cloneStack methods of ThreadContext return copies
of the Map and Stack.  In the LogEvent in impl getContextMap and getContextStack return the
actual Map and Stack that are in the LogEvent. Copying them would be too expensive.
> 
> I don't know that there are any components yet that can add, delete or modify MDC keys
or values, but i know that such a feature would be desired.  That said, the RewriteAppender
uses the RewritePolicy which creates a new LogEvent.
> 
> Ralph
> 
> On Aug 5, 2012, at 7:16 PM, Scott Deboy wrote:
> 
> > Chainsaw and some Receivers add properties to events to support tracking, for example,
log4jid is added by Chainsaw.
> >
> > One thing that needs to be clarified in the api contract is whether or not getContextMap
and getContextStack give you a copy of the map/stack or the original, as again, Chainsaw and
others will need to use some api to modify those values.
> >
> > Scott
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-dev-help@logging.apache.org
> 
> 


Mime
View raw message