At 02:03 PM 12/3/2004 +0100, you wrote:
>
>Jake,
>
>I've looked into the examples you've sent me. Can't make anything out
>of them.
>

I added stacktrace output to RollingFileAppender.rollover() to debug this issue. Here's the relevant part...

DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 10438 - About to rollover
org.apache.log4j.rolling.RolloverFailure: File [D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.5/logs/localhost.log.6] does not exist.
at org.apache.log4j.rolling.helper.Util.rename(Util.java:65)
at org.apache.log4j.rolling.SlidingWindowRollingPolicy.rollover(SlidingWindowRollingPolicy.java:81)
at org.apache.log4j.rolling.RollingFileAppender.rollover(RollingFileAppender.java:131)
at org.apache.log4j.rolling.RollingFileAppender.subAppend(RollingFileAppender.java:165)
at org.apache.log4j.WriterAppender.append(WriterAppender.java:147)
at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:247)
at org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:67)
at org.apache.log4j.Category.callAppenders(Category.java:218)
at org.apache.log4j.Category.forcedLog(Category.java:527)
at org.apache.log4j.Category.log(Category.java:1084)



I'm not completely clear on what should be happening, but it seems to me that...


1. The rolling shouldn't be happening every time I restart the server. I'm using a size based triggering policy with size set to 1000. That's kbytes, not bytes, right? This code should simply not be being called until the active file hits 1000 kbytes, right? For quick reference, here's the appender definition...

<appender name="LOCALHOST" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.SlidingWindowRollingPolicy">
<param name="activeFileName" value="${catalina.home}/logs/localhost.log"/>
<param name="fileNamePattern" value="${catalina.home}/logs/localhost.log.%i"/>
</rollingPolicy>
<triggeringPolicy class="org.apache.log4j.rolling.SizeBasedTriggeringPolicy">
<param name="maxFileSize" value="1000"/>
</triggeringPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p[%-8.8t]: %39.39c %-6r - %m%n"/>
</layout>
</appender>


2. The stack trace shows Util.rename(String from, String to) looking for the "from" file as "logs/localhost.log.6". I don't know why this should be since the activeFileName is set to localhost.log, which is what I would have expected the "from" file to be named. It seems to me that SlidingWindowRollingPolicy.rollover() is doing the wrong thing to figure out the active file and, thus, sending the wrong parameters to Util.rename().

Thoughts?

>One of the important tasks to be done before releasing 1.3, is to
>write unit tests which go through the whole web-app lifecycle to check
>that log4j releases all resources correctly. I started doing that with
>jetty but got sidetracked.
>
>Anyway, I'd appreciate small and manageable test cases reproducing the
>problem. You are a log4j committer, have you considered submitting
>test cases verifying that resources are correctly handled by log4j?
>

I can look into it, but am strapped for time as it is. You might notice that many of my emails come late at night when I should be in bed (like now). I'll do what I can, but I can't promise much.

Jake

>
>At 11:06 PM 12/2/2004, Jacob Kjome wrote:
>
>>I'm using CVS HEAD. At startup, the default selector is used. It is not
>>until
>>my one app that uses initializtion code starts up that I set the
>>ContextJNDISelector. I am also using the ServletContextLogAppender from
>>log4j-sandbox which hooks into the servlet api's servletContext.log() method.
>>So, in a roundabout way, logging from one repository (my app's repository) is
>>going to a logger defined in the default repository (although this seems to
>>work sporadically and I haven't figured out the conditions under which it
>>works
>>or doesn't work. I've debugged and append() always gets called, but then,
>>many
>>times, I see no output in the log file defined for my servlet context. If I
>>put another copy of log4j in my WEB-INF/lib, then it seems to work pretty
>>consistently, of course then app logging is completely separated from
>>container
>>logging except through servletContext.log()). I don't think any other
>>repository is being configured with the same config file since you turned off
>>autoconfiguration on non-default logger repositories. The only reason it
>>could
>>happen is if Joran is parsing twice. Wasn't that pointed out in another
>>thread
>>on the list? Just a shot in the dark.
>>
>>When I get home, I'll try removing usage of the ServletContextLogAppender and
>>see if the bad behavior goes away and report my findings.
>>
>>
>>Jake
>
>--
>Ceki G�lc�
>
> The complete log4j manual: http://qos.ch/eclm
> Professional log4j support: http://qos.ch/log4jSupport
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>



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



Reply via email to