To close the topic, I finally added - before calling the configure method -
a HierarchyEventListener, to the Logger.getRoot().getLoggerRepository(),
that renames FileAppender's files to add a suffix different for each VM.


J�r�mie.


> -----Message d'origine-----
> De : J�r�mie LOPEZ [mailto:[EMAIL PROTECTED] 
> Envoy� : mercredi 17 novembre 2004 14:28
> � : Log4J Users List
> Objet : RE: multiple VM on same RollingFileAppender
> 
>  
> 
> > -----Message d'origine-----
> > De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
> Envoy� : 
> > mercredi 17 novembre 2004 12:44 � : Log4J Users List Objet : Re: 
> > multiple VM on same RollingFileAppender
> > 
> > 
> > 
> > 
> > 
> > Hi Jeremie,
> > 
> > I have recently been dealing with this same issue, so I 
> believe that I 
> > can definitively say that it does not work. At least not on 
> a Windows 
> > system. And it really makes sense that it wouldn't. 
> Normally log4j is 
> > able to synchronize writes to a log file, even from 
> different threads. 
> > But when those writes are coming from different VMs, you 
> must depend 
> > on the OS to order the file accesses. It does not work; in fact our 
> > log file was basically useless. Another problem that was caused by 
> > this is that the log file doesn't roll over properly; the log file 
> > file.log never rolled to file.log.1, although if there was a 
> > file.log.x it would roll to file.log.x+1.
> > 
> > Our solution was to use the PropertyConfigurator so that as each 
> > application starts up (before writing any log messages) it causes 
> > initialition of log4j. We then iterate through the 
> appenders until we 
> > find the file appender. We modify the name of the file for the 
> > appender so that each application writes to it's own log file, 
> > although they all use the same config file. With this 
> simple method, 
> > everything is now working properly.
> 
> I was also thinking of adding in file names a VM identifier, 
> to have one file by VM, but I was thinking of extending the 
> FileAppender. Your PropertyConfigurator stuff is interesting...
> 
> Thanks...
> 
> > 
> > Dave
> > 
> > 
> > 
> > 
> >                                                               
> >                                                                    
> >                       J�r�mie LOPEZ                           
> >                                                                    
> >                       <[EMAIL PROTECTED]>            To:      
> > [EMAIL PROTECTED]                                 
> >            
> >                                                cc:            
> >                                                                    
> >                       11/17/2004 04:30         Subject: 
> > multiple VM on same RollingFileAppender                       
> >            
> >                       AM                                      
> >                                                                    
> >                       Please respond                          
> >                                                                    
> >                       to "Log4J Users                         
> >                                                                    
> >                       List"                                   
> >                                                                    
> >                                                               
> >                                                                    
> >                                                               
> >                                                                    
> > 
> > 
> > 
> > Hi all,
> > 
> > I've heard of problems with previous versions of Log4J when 
> multiple 
> > VM (using the same configuration) were logging in the same 
> > RollingFileAppender, like loss of messages at roll time (I 
> wasn't able 
> > to find this problem in the bug database)...
> > 
> > Does the problem remain? In other words, has someone some 
> experience 
> > of logging from multiple VM in the same 
> (Daily)RollingFileAppender and 
> > does it work well?
> > 
> > TIA,
> > 
> > 
> > J�r�mie.
> > 
> > 
> > 
> > 
> > 
> > 
> > This message contains information from Equifax Inc. which may be 
> > confidential and privileged.  If you are not an intended recipient, 
> > please refrain from any disclosure, copying, distribution or use of 
> > this information and note that such actions are prohibited.  If you 
> > have received this transmission in error, please notify by e-mail 
> > [EMAIL PROTECTED]
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> 

Reply via email to