logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kohinoor Lal Verma (EHS)" <Kohinoor.Ve...@ehs.ericsson.se>
Subject RE: Change properties at runtime
Date Thu, 12 Dec 2002 12:57:42 GMT
Thank Shapira,


Canyou tell me some properties that are nor reset-able ???


Rgds
Kohinoo



-----------------------------

Kohinoor Lal Verma,
Senior Systems Engineer,
Ericsson Mobile Commerce Platform, 
New Delhi, India.

-----Original Message-----
From: Shapira, Yoav [mailto:Yoav.Shapira@mpi.com]
Sent: Wednesday, December 11, 2002 6:37 PM
To: Log4J Users List
Subject: RE: Change properties at runtime


Hi,
Don't re-configure.  Programatically traverse the logger and/or appender
tree to set properties you want.  Not all properties are reset-able at
runtime.  

For example, to change the logger level at runtime:

private static void changeLoggerLevel(String fqcn, String level)
{
  if((fqcn == null) || (level == null))
    return;
  
  Logger logger = Logger.getLogger(fqcn);
  logger.setLevel(Level.toLevel(level));
}

I omitted exception handling code from the above, and I'm assuming
you're using the standard logger name = class (or package) name
convention.  FQCN stands for fully-qualified class name, but is a bit of
a mis-nomer as the above will work for a package as well.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Kohinoor Lal Verma (EHS) [mailto:Kohinoor.Verma@ehs.ericsson.se]
>Sent: Wednesday, December 11, 2002 6:14 AM
>To: 'Log4J Users List'
>Subject: Change properties at runtime
>
>Hi,
>
>I have a problem.
>I want change some properties of log4j on the fly without affecting
rest of
>the properties.
>I have tried useing PropertyConfigurator.configure(). Calling this
method
>removes all previously configured properties and only the new
properties
>are
>set. Can anybody help ???
>
>
>Rgds
>Kohinoor
>
>
>-----------------------------
>
>Kohinoor Lal Verma,
>Senior Systems Engineer,
>Ericsson Mobile Commerce Platform,
>New Delhi, India.
>
>--
>To unsubscribe, e-mail:   <mailto:log4j-user-
>unsubscribe@jakarta.apache.org>
>For additional commands, e-mail: <mailto:log4j-user-
>help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:log4j-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-user-help@jakarta.apache.org>


Mime
View raw message