logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Preuss, Jacqueline - ENCOWAY" <Preus...@encoway.de>
Subject AW: Problem with renaming files
Date Mon, 15 Oct 2007 06:42:59 GMT
Hi again,

I think I solved the problem for us. In our web application we programmatically created loggers
and appenders. Each time we wanted to log some events our log manager creates a new logger
with a specific name (name of the page etc.) if it didn't exist at the moment. That works
fine. The problem was that we also created a new DailyRollingFileAppender each time a logger
was created. This appender always pointed to the same log file. So we got as much handles
of this file as we initialized loggers for different pages. A renaming was impossible... We
now realized the appender as a singleton, i.e. create it only once a use always the same instance
of it. Now, we only have on handle on the file; tests were successfully :-)


> -----Urspr√ľngliche Nachricht-----
> Von: Preuss, Jacqueline - ENCOWAY [mailto:PreussJa@encoway.de]
> Gesendet: Donnerstag, 11. Oktober 2007 09:16
> An: Log4J Users List
> Betreff: AW: Problem with renaming files
> Hi.
> > Have you upgraded to log4j-1.2.15?  That should eliminate the loss of
> > earlier messages on a failed rename.
> I upgraded but on a failed rename the log file is overwritten...
> > Then you need to figure out why the rename is failing.  Are each of
> > your web applications writing log files in a different location?
> Yes, I think so. There are all writing in their sub directory
> gui/logs/script_logs/, ie in a Tomcat environment webapp A writes to
> Apache Software Foundation\Tomcat
> 5.0\webapps\webappA\gui\logs\script_logs and webapp B to Apache Software
> Foundation\Tomcat 5.0\webapps\webappB\gui\logs\script_logs.
>  > It appears you are attempting that in your configuration file, but is
> > that actually happening.  If you have multiple apps writing to the
> > same location, bad things are likely to happen.
> >You could use lsof
> > on 'nix or Unlocker or SysInternal's Process Monitor on Windows to
> > see what processes may have the file open.
> I installed Handle and ProcessExplorer on my Windows system to see how
> many processes open the log files. When I start Tomcat and then open my
> webapp in IE I have to entries for my log file :
> tomcat5.exe	pid:3096	NT-AUTORIT-T/SYSTEM 	F70:
> C:\Programme\Apache Software Foundation\Tomcat
> 5.0\webapps\webappA\gui\logs\script_logs\script_logger.txt
> tomcat5.exe	pid:3096	NT-AUTORIT-T/SYSTEM 	106C:
> C:\Programme\Apache Software Foundation\Tomcat
> 5.0\webapps\webappA\gui\logs\script_logs\script_logger.txt
> Does that mean that 2 processes trying to access the log file? How can
> this happen?
> > If not, are the privileges set so that the account that is running
> > Tomcat has the necessary rights to rename the file.
> I think it has.
> Regards,
> Jacqueline.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org

To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org

View raw message