Calls to PropertyConfigurator.configure(properties) appear to overwrite other logger instances!
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   brian_scott
Posted On:   Friday, December 5, 2003 11:32 AM

Hello friends. I have many servlets in an application, my idea was to have each one write to a dedicated log file. During init() each servlet creates a logger sending getClass().getName().

Unfortunately, all logger instances across servlets have the same properties as the last logger instance created; i.e., all servlets log to the same file and level.

I'm sure there is a way to to complete what I want to accomplish and that I'm missing something easy. Can anyone help?

Thanks.

brian

Re: Calls to PropertyConfigurator.configure(properties) appear to overwrite other logger instances!

Posted By:   ravi_sambandam  
Posted On:   Tuesday, December 9, 2003 03:51 AM

Hi,

If u want to log the info of each servlet class to different file ie.. one log file for one class, u need to define those many loggers and its other details in your property file and invoke the particular logger in ur respective class and log the info.

ur log4j will get initialized only when u execute this line of code
PropertyConfigurator.configure(LogFile);

and not every time when u get the logger object.

u write ur code in such a way that this will get executed only once in applications life.
About | Sitemap | Contact