logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Minella <mmine...@vmware.com>
Subject Map Lookup Question
Date Sat, 22 Dec 2012 00:23:36 GMT

I'm looking at the log4j 2 's thread specific features and had a question. In my code I set
an id as follows: 

ThreadContext.put( "id" , "Main" ); 

and attempt to reference it in my configuration file as shown below: 

< File name = "File" fileName = "/tmp/myLog.log" > 
< PatternLayout pattern = "%X{id} %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg ${ctx:id}
%n" /> 
</ File > 

If I use the lookup in the pattern layout to test it, it works fine. However, if I move that
lookup to the fileName attribute in the line above, the replacement doesn't occur (my file
ends up being named /tmp/${ctx.id}.log for example). Is that a limitation of that lookup or
am I missing something? Any insight that can be provided is appreciated. Thanks in advance!

Michael T Minella 

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message