| Author |
log4j - new instance for new class instance
|
Jim Cross
Greenhorn
Joined: Nov 20, 2003
Posts: 17
|
|
Hi all, I am currently writing an application which takes a properties file listing the properties for an arbitrary set of "Adapter" objects. Each Adapter should log to its own log file, with the log file for each specified in the props file. So, I might have 3 adapters - adapterA, adapterB and adapterC, which I want to log to adapterA.log, adapterB.log and adapterC.log. The problem I have at the moment is that all instances of the Adapter class log to the same log file - the file specified in the last Adapter object to be instantiated. The logger object in the Adapter class is non-static, and is initialised as follows: private Logger log = Logger.getLogger(AdapterWrapper.class.getName()); (I have also tried this without the .getName() method, but it makes no difference). In the constructor, the following call is made: DOMConfigurator.configure(log4jFile) where log4jFile is the name of the log4j file for that specific instance. Any ideas why all instances share the same file, and any way to get around it? Thanks, Jim
|
 |
 |
|
|
subject: log4j - new instance for new class instance
|
|
|