logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Log4J2 - Set log level programmatically
Date Mon, 12 May 2014 21:23:02 GMT
There are two ways to do it. 

1. Use JMX. There you would get access to the MBean and then call the appropriate method.
 I haven’t checked to see if that code is doing it correctly though.
2. See https://svn.apache.org/repos/asf/logging/log4j/log4j2/trunk/src/site/xdoc/manual/customconfig.xml.
Unfortunately that page has not been published to the site yet.  To set the level just get
the LoggerConfig you want, change its level and then call updateLoggers on the LoggerContext.


On May 12, 2014, at 1:02 PM, Karl Kildén <karl.kilden@gmail.com> wrote:

> Hi!
> Reading this
> http://mail-archives.apache.org/mod_mbox/logging-log4j-user/201305.mbox/%3CBAF05689-F627-457D-BD37-59BFCE46F69E@nicholaswilliams.net%3E
> hints that this is fully possible. This is also a very nice feature for
> webapps (especially those running in a cluster) because editing a file on
> the server is error prone and sometimes not even possible.
> The docs for log4j2 is pretty great overall but I would really like some
> info on setting the levels programmatically...
> Thanks for log4j, a staple framework I use for every project :-) Time to
> upgrade to log4j2 (hence the question)
> cheers

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