Alternative to change log4j logging level at runtime?

From: Eclifeww (sauwing.wong_at_gmail.com)
Date: 10/31/04


Date: 31 Oct 2004 01:49:59 -0700

Hi all,

I am invesitaging the way to change the log4j logging level at
runtime, and you comments are highly appreciated.

I have tried to use the logger.setLevel api which works fine in a toy
program. The toy program opens a server socket and once it receives
the client input thro' socket, it changes the logging level. However,
I am not sure whether it will has problem in multi-thread environment.

The api call in Log4j of the setLevel is simple as follows.
  public void setLevel(Level level) {
    this.level = level;
  }

Will it be problem?, if two thread access the level instance variable
in log4j. One reading it and one updating it?

Moreover, is there any build-in mechanism in Log4j to reload the
log4j.properties at regular interval? Thus, the logging level is
reloaded accordingly.

Please englighten me.

Thanks in advance for your ideas and inputs.

Earth



Relevant Pages

  • Re: Alternative to change log4j logging level at runtime?
    ... is there any build-in mechanism in Log4j to reload the ... Thus, the logging level is ...
    (comp.lang.java.programmer)
  • Re: turn off log4j printing
    ... > i am using log4j for keeping log in a file. ... > printing on the console? ... logging level for each package is specified. ... raise log level for individual classes/packages. ...
    (comp.lang.java.programmer)
  • Re: log4j: where to put properties file?
    ... "Aaron Boxer" wrote in message ... | latest release of log4j). ... log4j.properties needs to be on the classpath where log4j can find it. ...
    (comp.lang.java)
  • log4j: where to put properties file?
    ... My application is using a jar file MyJar.jar that uses log4j (I have the ... #to increase logging level ... Aaron Boxer ...
    (comp.lang.java.gui)
  • log4j Warning
    ... My application is using a jar file MyJar.jar that uses log4j (I have the ... #to increase logging level ... Aaron Boxer ...
    (comp.lang.java.programmer)