On Sun, Mar 5, 2017 at 6:43 PM, Matt Sicker <boa...@gmail.com> 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 keep the old depth before pushing, then restoring it with > the old depth to trim it back down. > > I'd support adding a pop(int) or similar method provided you can come up > with a better name than ContextStack2 or some other silly interface update. > Bleh, I forgot about that part. I do not think there is a better name. Gary > > On 5 March 2017 at 20:11, Gary Gregory <garydgreg...@gmail.com> wrote: > >> IIRC this is just old code mindlessly ported from log4j 1. >> >> Gary >> >> >> On Mar 5, 2017 6:17 PM, "Matt Sicker" <boa...@gmail.com> 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 Gregory <garydgreg...@gmail.com> wrote: >> >>> 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 adding pop(int)? >>> >>> Gary >>> >>> -- >>> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org >>> Java Persistence with Hibernate, Second Edition >>> <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8> >>> >>> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459> >>> JUnit in Action, Second Edition >>> <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22> >>> >>> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021> >>> Spring Batch in Action >>> <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action> >>> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951> >>> Blog: http://garygregory.wordpress.com >>> Home: http://garygregory.com/ >>> Tweet! http://twitter.com/GaryGregory >>> >> >> >> >> -- >> Matt Sicker <boa...@gmail.com> >> >> >> > > > -- > Matt Sicker <boa...@gmail.com> > -- E-Mail: garydgreg...@gmail.com | ggreg...@apache.org Java Persistence with Hibernate, Second Edition <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459> JUnit in Action, Second Edition <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021> Spring Batch in Action <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action> <http:////ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951> Blog: http://garygregory.wordpress.com Home: http://garygregory.com/ Tweet! http://twitter.com/GaryGregory