You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by Jacob Kjome <ho...@visi.com> on 2004/12/02 07:14:54 UTC

Joran, RollingFileAppender, and Rollover failure warnings

None of my RollingFileAppender files successfully roll over and I get the 
following message ever time I start up Tomcat when my active files exists 
already (log4j debugging was enabled.  I'm concerned about the WARN 
messages only)...

DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11406  - About to 
rollover
WARN [Thread-1]: pache.log4j.rolling.RollingFileAppender 11422  - 
RolloverFailure occurred. Deferring rollover.
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11422  - Active 
file name is now 
[D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log].
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11422  - setFile 
called: D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log, true
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11422  - setFile ended
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11594  - About to 
rollover
WARN [Thread-1]: pache.log4j.rolling.RollingFileAppender 11594  - 
RolloverFailure occurred. Deferring rollover.
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11594  - Active 
file name is now 
[D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log].
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11594  - setFile 
called: D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log, true
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11594  - setFile ended
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11594  - About to 
rollover
WARN [Thread-1]: pache.log4j.rolling.RollingFileAppender 11594  - 
RolloverFailure occurred. Deferring rollover.
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11594  - Active 
file name is now 
[D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log].
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11594  - setFile 
called: D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log, true
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11594  - setFile ended
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11953  - About to 
rollover
WARN [Thread-1]: pache.log4j.rolling.RollingFileAppender 12031  - 
RolloverFailure occurred. Deferring rollover.
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 12031  - Active 
file name is now 
[D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log].
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 12031  - setFile 
called: D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log, true
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 12031  - setFile ended
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 12031  - About to 
rollover
WARN [Thread-1]: pache.log4j.rolling.RollingFileAppender 12031  - 
RolloverFailure occurred. Deferring rollover.
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 12031  - Active 
file name is now 
[D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log].
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 12031  - setFile 
called: D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log, true
DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 12031  - setFile ended


Here are the appenders in question....

<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>

<appender name="PICOSERVLET" 
class="org.apache.log4j.rolling.RollingFileAppender">
     <param name="Append" value="true"/>
     <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
         <param name="activeFileName" 
value="${catalina.home}/logs/localhost_picoservlet.log"/>
         <param name="FileNamePattern" 
value="${catalina.home}/logs/localhost_picoservlet.log.%d"/>
     </rollingPolicy>
     <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%c{1} %-6r - %m%n"/>
     </layout>
</appender>

<appender name="SAM" class="org.apache.log4j.rolling.RollingFileAppender">
     <param name="Append" value="true"/>
     <rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
         <param name="activeFileName" 
value="${catalina.home}/logs/localhost_sam.log"/>
         <param name="FileNamePattern" 
value="${catalina.home}/logs/localhost_sam.log.%d"/>
     </rollingPolicy>
     <layout class="org.apache.log4j.PatternLayout">
         <param name="ConversionPattern" value="%c{1} %-6r - %m%n"/>
     </layout>
</appender>


What have I done wrong?

I also get messages like this upon startup...

WARN [Thread-1]: he.log4j.rolling.helper.FileNamePattern 672    - Assuming 
daily rotation schedule

Am I missing something in the configuration of the rolling appenders?  I'd 
like to make sure I have everything set properly and avoid the warnings.


Jake


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


Re: Joran, RollingFileAppender, and Rollover failure warnings

Posted by Ceki Gülcü <ce...@qos.ch>.
Jake,

One point where log4j 1.3alpha3 will silently fail is if your XML config 
file contains a reference to log4j.dtd in the DOCTYPE declaration. But you 
don't have that as your log4j.xml file attests:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration>
....

FYI, Joran currently takes to passes at config files. Once to verify that 
its well-formed and the second to actually parse to configure log4j. The 
first pass does not do anything other then check that the input is well-formed.


At 08:13 AM 12/3/2004, Jacob Kjome wrote:
>Hi Ceki,
>
>I just sent a zip file to you directly since it would be rejected from the 
>list.  I also removed the application that sets the repository selector 
>via the servlet context initializer code.  This means also that the 
>servlet context log appender is not being used either.  I'm still seeing 
>the behavior.  Please see the email I sent directly to you for info.
>
>Jake

-- 
Ceki Gülcü

  The complete log4j manual:  http://qos.ch/eclm
  Professional log4j support: http://qos.ch/log4jSupport  



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


Re: Joran, RollingFileAppender, and Rollover failure warnings

Posted by Jacob Kjome <ho...@visi.com>.
Hi Ceki,

I just sent a zip file to you directly since it would be rejected from the 
list.  I also removed the application that sets the repository selector via 
the servlet context initializer code.  This means also that the servlet 
context log appender is not being used either.  I'm still seeing the 
behavior.  Please see the email I sent directly to you for info.

Jake

At 04:06 PM 12/2/2004 -0600, you wrote:
 >Quoting Ceki Gülcü <ce...@qos.ch>:
 >
 >> Jake,
 >>
 >> The config file looks good.
 >>
 >
 >[cut]
 >
 >> >Am I missing something in the configuration of the rolling appenders?  I'd
 >> >like to make sure I have everything set properly and avoid the warnings.
 >>
 >> The rollover failure is real though. (Fortunately it will not cause data
 >> loss as was the case in previous versions of log4j.) Something is
 >> preventing the file from being renamed
 >>
 >> One thing which raises suspicions is the missing message (of level DEBUG)
 >> by the rename method in o.a.l.roling.helper.Util
 >>
 >> DEBUG[Thread-1]: org.apache.log4j.rolling.helper.Util 11594  - Renaming
 >> file [D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log]
 >> toFile [D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log.1]
 >>
 >> Why is this log statement is missing? Is the logger named
 >> "o.a.l.rolling.helper.Util" disabled?
 >>
 >
 >I have a logger defined as:
 >
 ><logger name="org.apache.log4j">
 >    <level value="debug"/>
 ></logger>
 >
 >it inherits the console appender from the root logger.  Oh, and I have
 ><log4j:configuration debug="false">
 >
 >> I'd venture to say that more than one LoggerRepository has a handle to
 >> "../jakarta-tomcat-5.5.4/logs/localhost.log". Is it possible that more than
 >> one repository is being automatically configured with the same config file?
 >> Are you using log4j-1.3alpha3 or CVS head? Have you set a 
RepositorySelector?
 >>
 >
 >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
 >
 >
 >
 >
 >---------------------------------------------------------------------
 >To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
 >For additional commands, e-mail: log4j-dev-help@logging.apache.org


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


Re: Joran, RollingFileAppender, and Rollover failure warnings

Posted by Jacob Kjome <ho...@visi.com>.
At 11:48 PM 12/7/2004 -0600, you wrote:
 >At 08:29 PM 12/7/2004 +0100, you wrote:
 > >At 08:30 AM 12/4/2004, Jacob Kjome wrote:
 > >
 > >>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?
 > >
 > >No, it's bytes. For KB, you have to write
 > >
 > >  <param name="maxFileSize" value="1000KB"/>
 > >  or
 > >  <param name="maxFileSize" value="1MB"/>
 > >
 > >See page 102 of the complete manual.
 > >

LOG4J-INTERNAL: 2004-12-09 00:33:37,328 WARN [Thread-1] 
org.apache.log4j.config.PropertySetter#setProperty:179)- Failed to set 
property [maxFileSize] to value "1000KB".

Ceki, this was true for Log4j-1.2.x, but I don't think it is true for 
Log4j-1.3.

   public void setMaxFileSize(long l) {
     maxFileSize = l;
   }

It takes a long, not a String, so how could "KB" be in there?

Did you plan on not keeping parity with Log4j-1.2.x's file size param 
settings, or was this an oversight?

I changed it to <param name="maxFileSize" value="100000"/> and all is well 
(after locally fixing FixedWindowRollingPolicy to not bomb out as I 
describe in my other email).


Jake


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


Re: Joran, RollingFileAppender, and Rollover failure warnings

Posted by Jacob Kjome <ho...@visi.com>.
At 08:29 PM 12/7/2004 +0100, you wrote:
 >At 08:30 AM 12/4/2004, Jacob Kjome wrote:
 >
 >>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?
 >
 >No, it's bytes. For KB, you have to write
 >
 >  <param name="maxFileSize" value="1000KB"/>
 >  or
 >  <param name="maxFileSize" value="1MB"/>
 >
 >See page 102 of the complete manual.
 >

I guess I should have known this.  Haven't really made much use of the 
rolling appenders up to now as you can tell.

 >[cut]
 >
 >>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?
 >
 >The window slides to the left. If N is the last item in the windows,
 >file.N is deleted, file.N-1 is renamed to file.N, file.N-2 to
 >file.N-1, ..., file.1 to file.2 and the previous active file renamed
 >to file.1
 >
 >
 >Does that help at all?
 >

Well, it proves to me that I don't understand what a sliding window rolling 
policy is.  However, my understanding of it is a bit beside the point.  You 
have my configuration and I think you said it looked ok to you.  You have 
the full log file and then partial stack trace that I posted later showing 
the details where the logging just reported the rollover failure.  There is 
obviously a problem if my config is correct but I get these rolling 
exceptions with Log4j saying it can't find a file it is looking for.  You 
do agree that there is a problem, right?  I'm hoping what I've provided 
will help track it down because I'm just not sure I understand what sliding 
window the code is doing?  Should I even be using this appender for my 
config?  Can you give me an example that will work for the localhost 
appender that does what I want without using the sliding window rolling 
policy?  To be honest, I'm just using it because I saw it in an 
example.  There isn't much documentation around this stuff yet.


Jake


 >--
 >Ceki Gülcü
 >
 >  The complete log4j manual:  http://qos.ch/log4j/
 >
 >
 >
 >---------------------------------------------------------------------
 >To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
 >For additional commands, e-mail: log4j-dev-help@logging.apache.org
 >
 >  


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


Re: Joran, RollingFileAppender, and Rollover failure warnings

Posted by Ceki Gülcü <ce...@qos.ch>.
At 08:30 AM 12/4/2004, Jacob Kjome wrote:

>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?

No, it's bytes. For KB, you have to write

  <param name="maxFileSize" value="1000KB"/>
  or
  <param name="maxFileSize" value="1MB"/>

See page 102 of the complete manual.

[cut]

>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?

The window slides to the left. If N is the last item in the windows,
file.N is deleted, file.N-1 is renamed to file.N, file.N-2 to
file.N-1, ..., file.1 to file.2 and the previous active file renamed
to file.1


Does that help at all?

-- 
Ceki Gülcü

  The complete log4j manual:  http://qos.ch/log4j/  



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


Re: Joran, RollingFileAppender, and Rollover failure warnings

Posted by Jacob Kjome <ho...@visi.com>.
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: log4j-dev-unsubscribe@logging.apache.org
 >For additional commands, e-mail: log4j-dev-help@logging.apache.org
 >
 >  


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


Re: Joran, RollingFileAppender, and Rollover failure warnings

Posted by Curt Arnold <ca...@apache.org>.
On Dec 3, 2004, at 7:03 AM, Ceki Gülcü wrote:
> 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?
>

Have you given any thoughts about doing coverage analysis on the tests 
to see how much of the code base is tested (and identify dead code)?  
I've used Clover (http://www.cenqua.com/clover/) on other projects and 
it has been fairly straightforward.  The product is commercial, but 
will give free licenses for Open Source project developers.


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


Re: Joran, RollingFileAppender, and Rollover failure warnings

Posted by Ceki Gülcü <ce...@qos.ch>.
Jake,

I've looked into the examples you've sent me. Can't make anything out
of them.

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?


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: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org


Re: Joran, RollingFileAppender, and Rollover failure warnings

Posted by Jacob Kjome <ho...@visi.com>.
Quoting Ceki Gülcü <ce...@qos.ch>:

> Jake,
>
> The config file looks good.
>

[cut]

> >Am I missing something in the configuration of the rolling appenders?  I'd
> >like to make sure I have everything set properly and avoid the warnings.
>
> The rollover failure is real though. (Fortunately it will not cause data
> loss as was the case in previous versions of log4j.) Something is
> preventing the file from being renamed
>
> One thing which raises suspicions is the missing message (of level DEBUG)
> by the rename method in o.a.l.roling.helper.Util
>
> DEBUG[Thread-1]: org.apache.log4j.rolling.helper.Util 11594  - Renaming
> file [D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log]
> toFile [D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log.1]
>
> Why is this log statement is missing? Is the logger named
> "o.a.l.rolling.helper.Util" disabled?
>

I have a logger defined as:

<logger name="org.apache.log4j">
    <level value="debug"/>
</logger>

it inherits the console appender from the root logger.  Oh, and I have
<log4j:configuration debug="false">

> I'd venture to say that more than one LoggerRepository has a handle to
> "../jakarta-tomcat-5.5.4/logs/localhost.log". Is it possible that more than
> one repository is being automatically configured with the same config file?
> Are you using log4j-1.3alpha3 or CVS head? Have you set a RepositorySelector?
>

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




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


Re: Joran, RollingFileAppender, and Rollover failure warnings

Posted by Ceki Gülcü <ce...@qos.ch>.
Jake,

The config file looks good.

At 07:14 AM 12/2/2004, Jacob Kjome wrote:

>None of my RollingFileAppender files successfully roll over and I get the 
>following message ever time I start up Tomcat when my active files exists 
>already (log4j debugging was enabled.  I'm concerned about the WARN 
>messages only)...
>
>DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11406  - About to 
>rollover
>WARN [Thread-1]: pache.log4j.rolling.RollingFileAppender 11422  - 
>RolloverFailure occurred. Deferring rollover.
>DEBUG[Thread-1]: pache.log4j.rolling.RollingFileAppender 11422  - Active 
>file name is now 
>[D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log].

[cut]

>What have I done wrong?

Nothing apparently. More below.

>I also get messages like this upon startup...
>
>WARN [Thread-1]: he.log4j.rolling.helper.FileNamePattern 672    - Assuming 
>daily rotation schedule

Consider this as a message of level DEBUG. It was incorrectly marked as 
WARN. Just changed in CVS head. It's unrelated with the rollover failure.

>Am I missing something in the configuration of the rolling appenders?  I'd 
>like to make sure I have everything set properly and avoid the warnings.

The rollover failure is real though. (Fortunately it will not cause data 
loss as was the case in previous versions of log4j.) Something is 
preventing the file from being renamed

One thing which raises suspicions is the missing message (of level DEBUG) 
by the rename method in o.a.l.roling.helper.Util

DEBUG[Thread-1]: org.apache.log4j.rolling.helper.Util 11594  - Renaming 
file [D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log] 
toFile [D:\Java\Apache\Jakarta\jakarta-tomcat-5.5.4/logs/localhost.log.1]

Why is this log statement is missing? Is the logger named 
"o.a.l.rolling.helper.Util" disabled?

I'd venture to say that more than one LoggerRepository has a handle to 
"../jakarta-tomcat-5.5.4/logs/localhost.log". Is it possible that more than 
one repository is being automatically configured with the same config file? 
Are you using log4j-1.3alpha3 or CVS head? Have you set a RepositorySelector?


>Jake

-- 
Ceki Gülcü

  The complete log4j manual:  http://qos.ch/eclm
  Professional log4j support: http://qos.ch/log4jSupport  



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