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.

Ralph


On May 12, 2014, at 1:02 PM, Karl Kildén <[email protected]> wrote:

> Hi!
> 
> Reading this
> http://mail-archives.apache.org/mod_mbox/logging-log4j-user/201305.mbox/%[email protected]%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

Reply via email to