By providing a StringMap interface that allows Object values we unlocked 
numerous custom extensions that the previous Map<String, String> interface did 
not allow. 

However the public API should probably stay restricted to String values, at 
least for now. This is to prevent memory leaks in web applications: in web 
applications ThreadLocals should only contain JDK classes. 
We may be able to add a public ThreadContext::putValue(String, Object) method 
after has been addressed. 


Sent from my iPhone

> On 19 Oct 2016, at 0:46, Mikael Ståldal <> wrote:
> As part of we added support 
> for non-String values in log event's context data (with the 
> org.apache.logging.log4j.util.StringMap interface).
> However, as far as I can see, we do not leverage the possibility to use 
> non-String values anywhere. Do we have any plans to do that? Such as a  
> putValue(String key, Object value) method in 
> org.apache.logging.log4j.ThreadContext?
> -- 
> Mikael Ståldal
> Senior software developer 
> Magine TV
> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |             
> Privileged and/or Confidential Information may be contained in this message. 
> If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not 
> copy or deliver this message to anyone. In such case, 
> you should destroy this message and kindly notify the sender by reply email.  

Reply via email to