Yes, but I need to recall it because I am taking some information from the properties 
file that changes from one logger to the other, like the Log file name. Do you know if 
possible to change this log filename without re-reading the "log4j.properties" file? 

-----Original Message-----
From: ext Scott Farquhar [mailto:[EMAIL PROTECTED]]
Sent: 22. April 2002 13:20
To: Log4J Users List
Subject: Re: Different logger objects


You only need to call PropertyConfigure.configure() once per thread.

This could be the source of your problem.

Cheers,
Scott

[EMAIL PROTECTED] wrote:
> Hi all,
> 
> Is it possible to define two or more different logger objects in one Java Program? I 
>am trying to create an own logger for each created object in the program, but using 
>the instance Logger.getLogger(name) makes this no possible because when I create the 
>second instance I "loose" the reference to the first one, probably because using 
>static variables that changes and each object is using. Don't know how to do...
> 
> I have tested if it's possible with the following example code:
> 
>       this.logger1 = Logger.getLogger(MyClass.class.getName()+name1);
>       PropertyConfigurator.configure("log4j.properties");
>       logger1.info("- Logging initialized --");
>       
>       this.logger2 = Logger.getLogger(ApiTesterTool.class.getName()+name2);
>       PropertyConfigurator.configure("log4j.properties");
>       logger2.info("- Logging initialized --");
>       
>       // Till here the code works perfectly, the first logging information is 
>written in one file and the other in the other one
>       // Next line pretends to write again in logger1
>       
>       logger1.info("This line must be written in file defined by logger1 but is 
>written in logger2 !!!!!!!!");
> 
> Please help a poor Java programmer ;-)
> 
> Jaume
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 


-- 
Scott Farquhar :: [EMAIL PROTECTED]

Atlassian :: http://www.atlassian.com
      Supporting YOUR J2EE World



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


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

Reply via email to