You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Bender Heri <HB...@Ergonomics.ch> on 2005/11/29 11:38:01 UTC

static loggers (was Logger serialization)

There are situations where you cant use static members. If you separate logging universes by using a specialzed RepositorySelector, which returns different loggers depending on diffenrent MDC values. If the basic framework classes, which are used in different applications (moduls), but running within the same virtual machine, would have static logger variables, they would always log to the same logger. The MDC which runs first into this class would win. 

There are cases where you not even can use instance members as loggers: A static helper function whithin a utitlity class must get the logger on the fly if you want to separate logger universes like descrbed above.

Heri

> -----Original Message-----
> From: Curt Arnold [mailto:carnold@apache.org]
> Sent: Tuesday, November 29, 2005 2:16 AM
> To: Log4J Users List
> Subject: Re: Logger serialization
> 
...
> However, having a logger as an instance variable is rarely desirable.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org