Oh, good catch, never used the API like that outside of unit tests. On 9 November 2015 at 23:21, Ralph Goers <[email protected]> wrote:
> Matt, the advice below won’t work properly. The LoggerConfig must be > modified, not the Logger. Then updateLoggers must be called (which will > update the logger’s level). > > Ralph > > > On Nov 9, 2015, at 9:07 PM, Matt Sicker <[email protected]> wrote: > > > > You can find the Logger from LogManager, cast to > > org.apache.logging.log4j.core.Logger, and use setLevel, though I bet > > there's a better way to do this via configuration files. You can reload > the > > configuration file and modify that from the user, but that might be > > overkill here. > > > > On 9 November 2015 at 21:59, John Lussmyer <[email protected] > <mailto:[email protected]>> wrote: > > > >> Looking at https://logging.apache.org/log4j/2.0/manual/jmx.html > >> Doesn't seem like the solution. > >> Asking the user to bring up jconsole seems rather excessive. > >> I just want to provide 3 radio buttons in my configuration. Logging > >> Normal, Medium, Full. > >> > >> -----Original Message----- > >> From: Matt Sicker [mailto:[email protected]] > >> Sent: Monday, November 09, 2015 7:54 PM > >> To: Log4J Users List > >> Subject: Re: Change log level on the fly? > >> > >> Loggers can be reconfigured through JMX. > >> > >> On 9 November 2015 at 19:53, John Lussmyer <[email protected]> > wrote: > >> > >>> I'm hoping there is an easy to to just change the root level of my > >>> logger configuration on the fly. > >>> I want to be able to provide a configuration option to my users to > >>> turn up the logging level. > >>> I don't want to reconfigure everything, just change the level. > >>> > >>> Is there any easy way to do that? Or do I have to build a > >>> Configuration factory? > >>> > >>> > >>> ________________________________ > >>> Confidentiality notice: This message may contain confidential > >> information. > >>> It is intended only for the person to whom it is addressed. If you are > >>> not that person, you should not use this message. We request that you > >>> notify us by replying to this message, and then delete all copies > >>> including any contained in your reply. Thank you. > >>> > >> > >> > >> > >> -- > >> Matt Sicker <[email protected]> > >> > > > > > > > > -- > > Matt Sicker <[email protected] <mailto:[email protected]>> > > -- Matt Sicker <[email protected]>
