To expand on Orko's comment, the code to do this would look something like:
// to get a logger level as a string
public String getLoggerLevel(String loggerName) {
return Logger.getLogger(loggerName).getLevel().toString();
}
// to set a logger level as a string
public void setLoggerLevel(String loggerName, String levelName) {
Level level = Level.tolevel(levelName);
Logger.getLogger(loggerName).setLevel(level);
}
On Dec 12, 2007 4:26 PM, orko <[EMAIL PROTECTED]> wrote:
> There is a method called setLevel in Category. You may want to getLevel of
> the logger and then set it up to a new log level.
>
>
> David Killeffer <[EMAIL PROTECTED]> wrote: I'm trying to write a servlet
> that will let me change the log level (and
> thereby optionally turn the logger on/off) of a logger that is running in
> my
> application code somewhere else. Currently I have logging running in my
> application fine, and I have been able to get information on the logger
> and
> appenders that are running, but changing the level of the logger doesn't
> stop the application code from continuing to log.
>
> Is it possible to change the log level of a logger in memory
> (programmatically) by way of a servlet that would then change logging for
> my
> application code?
>
> - David
>
>