Does this help: https://garygregory.wordpress.com/2016/01/11/changing-log-levels-in-log4j2/
? Gary On Mon, Nov 28, 2016 at 12:28 PM, Marcel Stör <mar...@frightanic.com> wrote: > For years we've been shipping our web applications with a simple and > ugly but tremendously effective Servlet to switch log4j log levels at > runtime[1]. In fact, it's been so effective on countless occasions > (read: debugging sessions in production environments) that we never > bothered looking into alternatives. > > Until we started introducing log4j2. > > The old Servlet uses LogManager.getRootLogger() and > LogManager.getCurrentLoggers() to build the list of loggers and > Logger.getLogger(String).setLevel(Level.toLevel(String)) to update them. > > I learned that with log4j2 you don't actually manipulate loggers but > their respective configuration[2]. Based on what I saw I assume I could > re-write our Servlet to work with log2j2. Please correct me if my > assumptions are wrong. > > However, it may very well be that I missed some of the new features > which would make our Servlet altogether obsolete. DynamicThresholdFilter > for example is nice but solves a related but slightly different problem. > Is there a log4j2 feature that could replace our Servlet? > > [1] http://imgur.com/a/JHaOY > [2] http://stackoverflow.com/q/17511763/131929 > > -- > Marcel Stör, http://frightanic.com > Couchsurfing: http://www.couchsurfing.com/people/marcelstoer > O< ascii ribbon campaign - stop html mail - http://j.mp/1OThh9L > > -- 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