You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "WYNIWYG MOUAWAD Philippe (CAMPUS)" <EX...@DECATHLON.COM> on 2005/02/07 19:58:29 UTC

RollingFileAppender is not rolling log files in OC4J.

Windows NT SP4
OC4J => 9.0.4
Log4J => 1.2.8
I tried with log4j as a shared library in applib or in WEB-INF/lib => = Same result
All was working fine on Weblogic 7.0 for a year now.

Problem => RollingFileAppender is not rolling log files.
I know that on Windows NT, RollingFileAppender fails when renameTo fails silently
and this is the problem, but I don't know why the file is handled by a process (I'm not opening it)

I'm using an initialisation Servlet with a load-on-startup at 1 to 
initialize log4j and a ServletContextListener to destroy it (LogManager.shutdown()).
(The 2 objects call initializeLog4j and shutdownLog4j on =
org.apache.log4j.servlet.InitShutdownController a log4j previous  =
contribution from Jacob Kjome)
(I know there is a problem due to OC4J lifecycle (different from =
Weblogic, see below) but I will solve it later, I tried to call =
shutdownLog4j in the destroys of the servlets but I have the same =
phenomenon, the Rolling File appender is not closed)

log4j.debug=true
log4j.rootCategory=DEBUG,FILE

# FILE
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.File=C:/logs/logs/newProject.log
log4j.appender.FILE.MaxFileSize=1000KB
log4j.appender.FILE.MaxBackupIndex=10
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
log4j.appender.FILE.layout.ConversionPattern=%d - %5p - %c: %m%n=20

I traced the problem and it's due to the fact that OC4J has the =
following init sequence:
Servlets' init()
ContextListener init()
ContextListener destroy()
Servlets' destroy()

At this step, the rollingFile is handled by 1 handle from OC4J

and on the first url call:
Servlets' init()
ContextListener init()
At this step, the rollingFile is handled by 2 handles from OC4J

If I undeploy the webapp, the handles remain.
If I redeploy a new handle is created (end up with 3)

C:\>C:\PMD\handle\handle.exe C:\logs\logs\newProject.log

Handle v2.2
Copyright (C) 1997-2004 Mark Russinovich
Sysinternals - www.sysinternals.com

System             pid: 8      C:\logs\logs\newProject.log
System             pid: 8      C:\logs\logs\newProject.log
System             pid: 8      C:\logs\logs\newProject.log


Thanks for your help.

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