I use multiple configuration files, divded up logically by application
subsystem, by using wrapper classes (each one implements the singleton
pattern) around my Logger instances and then use the configuration
option to specify where to load. For example if using an XML
configuration file:

        
DOMConfigurator.configure(getClass().getClassLoader().getResource(path
to configuration file));

This of course leads to problems with printing out code locations since
all logging goes through one class now but can be solved by using the
log() methods of Logger. (See javadoc for details).

I think this is the only way, and if you rely on default initialization,
then even this is not possible.

Cheers,
Philip.
 

-----Original Message-----
From: Bender Heri [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 09, 2006 1:47 AM
To: Log4J Users List
Subject: RE: Using multiple log4j.properties files

Log4j is a singleton within the same JVM, more precise in each
classloader of the JVM running. So you can have only one configuration.
To give more help you must provide more details about your application
and your goal.
Heri

-----Original Message-----
From: Asaf Lahav [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 09, 2006 10:29 AM
To: [email protected]
Subject: Using multiple log4j.properties files



Hi all,

 

We are using common-logging and log4j in our product, and I was
wondering whether it's possible to use log4j when using multiple
log4j.properties files?

What I would like to achieve is the possibility to create several
configuration (log4j.properties) files and that each log4j 'log'
instance will be able to use the log4j.properties configuration file of
its choice (according to application logic of course).

How can I achieve that? Is it possible to do that with log4j?

 

Thanks in advance,

 

 

Asaf Lahav

VP R&D, Prima Grid LTD.

Cellular:  972-54-4717955

Phone:   972-3-6540255

Fax:       972-3-6540254



 




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

Reply via email to