I dont know how to use the getLoggerLevel mehtod but there is a smarter way to configure your level attribute!
Go to the conf/log4j.xml file and add a new category e.g. like this
category name="myApp.myCat" priority value="INFO" appender-ref ref="CONSOLE" category
and then init your Logger to
Logger log= Logger.getLogger("myApp.myCat");
there you are (do the same with your own appenders).
Thanks. But what I want to do is use the web-console to switch root logger (or some other logger) log levels at runtime. If I understand correctly, editing log4j.xml will require a restart of jboss. I want to be able to switch to DEBUG, do some debugging, and then switch back to INFO, for example.
thats right modifying the log4j need a reboot. But you can init some default settings like your default level. When you like to change the level on the fly try the following:
Logger log= Logger.getRootLogger(); //Logger log= Logger.getLogger("myApp"); log.setLevel(Level.DEBUG); ... log.setLevel(Level.INFO);
Hm. On 3.2.1 and 3.2.3, Jboss picks up modifications of log4j.xml within the next 30 seconds without a reboot.