Re: org.apache.logging.log4j.ThreadContext.pop()

2017-03-07 Thread Matt Sicker
Sounds appropriate for a default method, though! One day. On 8 March 2017 at 01:46, Gary Gregory wrote: > On Sun, Mar 5, 2017 at 6:43 PM, Matt Sicker wrote: > >> Looking at the code for trim(int), it seems to do the opposite actually: >> >> https://github.com/apache/logging-log4j2/blob/master/l

Re: org.apache.logging.log4j.ThreadContext.pop()

2017-03-07 Thread Gary Gregory
On Sun, Mar 5, 2017 at 6:43 PM, Matt Sicker wrote: > Looking at the code for trim(int), it seems to do the opposite actually: > > https://github.com/apache/logging-log4j2/blob/master/ > log4j-api/src/main/java/org/apache/logging/log4j/spi/ > MutableThreadContextStack.java#L102 > > You'd have to k

Re: org.apache.logging.log4j.ThreadContext.pop()

2017-03-05 Thread Matt Sicker
Looking at the code for trim(int), it seems to do the opposite actually: https://github.com/apache/logging-log4j2/blob/master/log4j-api/src/main/java/org/apache/logging/log4j/spi/MutableThreadContextStack.java#L102 You'd have to keep the old depth before pushing, then restoring it with the old de

Re: org.apache.logging.log4j.ThreadContext.pop()

2017-03-05 Thread Gary Gregory
IIRC this is just old code mindlessly ported from log4j 1. Gary On Mar 5, 2017 6:17 PM, "Matt Sicker" wrote: I'm interested to hear what you use the stack instead of map for in the first place. There's already a method for this, though: ThreadContext.trim(int). On 5 March 2017 at 09:52, Gary

Re: org.apache.logging.log4j.ThreadContext.pop()

2017-03-05 Thread Matt Sicker
I'm interested to hear what you use the stack instead of map for in the first place. There's already a method for this, though: ThreadContext.trim(int). On 5 March 2017 at 09:52, Gary Gregory wrote: > When I want to pop the ThreadContext more than once I do: > > ThreadContext.pop(); > ThreadCon

org.apache.logging.log4j.ThreadContext.pop()

2017-03-05 Thread Gary Gregory
When I want to pop the ThreadContext more than once I do: ThreadContext.pop(); ThreadContext.pop(); ThreadContext.pop(); ThreadContext.pop(); Instead I'd like to update some legacy code to: ThreadContext.pop(4); (I know, I know, I should update that old code to push()/clear()) Thoughts on addi