--- MiChAeL xEnAkIs <[EMAIL PROTECTED]> wrote:
> Hey all -
> 

<snip>

> 
> I'm wanting to go the route of configuring the logging framework via
> the XML "properties" file w/ the following reservations:
> 
> When looking through the example code provided, I notice that the
> example-classes each have static Category vars which are _the_
> categories used for logging (which are declared and defined w/in the
> declaration statements).  However, these classes also include calls
> to BasicConfigurator<or a subclass>.configure() or .configure(String
> configFile).  As I understand, the Log4J framework will maintain the
> instances of the various categories such that separate calls to
> Category.getInstance(<instance-name>) will _always_ return the same
> instance for that particular name.
> 

Yes. If you call Category.getInstance() with the same class/string
name, you'll get the same category. The examples are simply caching the
result since there is a hashing performance hit for calling
Category.getInstance() repeatedly for the same category.

> Now, as I also understand it, when a class is first referenced, its
> static var's are instantiated at that time.  For the sake of
> argument, assume that I have static Category object defined for each
> class _and_ my .xml properties file provides the actual (full)
> definitions for these, i.e. including the Appender definition, file
> locations, etc.
>  

Ok.

> So, up to the point of my calling the "appropriate" .configure()
> method, the static Category for each class will be just a "generic"
> Category, yes?
> 

Not sure this matters. Until log4j is initialized you can't do any
logging anyway. I'm not sure what you mean by a "generic" category.

> Also, when .configure() is called, will the current "generic"
> Category definition(s) be replaced w/ those in the .xml properties
> file (thereby ensuring a single Category instance for each
> <instance-name>)?
> 

In your way of thinking, yes.

The best way to evaluate log4j is to try it out. Go ahead download it,
create the scenario you've just described and make sure it works as you
expect. If you have problems then, we'll be better able to help you
out.

-- Don

__________________________________________________
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
http://personals.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to