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 Allistair Crossley <Al...@QAS.com> on 2004/08/03 15:53:10 UTC

RE: Commons Logging breaks with log4j.1.3 alpha -> Caused by: java.lang.NoSuchFieldError: DEBUG

Hi Ceki,

When the error occurs, the log is actually wiped clear and all previous logging is lost. I have retested this to make sure I am not leading you astray.

I have a log called sys-authentication.log for example which I have setup to roll every minute as follows;

log4j.logger.Authentication=debug, AuthenticationA
log4j.appender.AuthenticationA=org.apache.log4j.DailyRollingFileAppender
log4j.appender.AuthenticationA.ImmediateFlush=true
log4j.appender.AuthenticationA.File=d:/jakarta-tomcat-5.0.25/logs/sys-authentication.log
log4j.appender.AuthenticationA.Append=true
log4j.appender.AuthenticationA.layout=org.apache.log4j.PatternLayout
log4j.appender.AuthenticationA.layout.ConversionPattern=%d - %5p (%C:%L) - %m%n
log4j.appender.AuthenticationA.DatePattern='.'yyyy-MM-dd-HH-mm

Before I tested, I checked the current and only sys-authentication.log and it contained

2004-08-03 14:24:34,245 -  INFO (com.qas.newmedia.intranet.iq.base.actions.SecuredBaseAction:113) - remote user=QAS\allistairc

Now, I put 2 fresh requests into the web application.  reopened the only sys-authentication.log and it contained the following:

2004-08-03 14:49:03,169 -  INFO (com.qas.newmedia.intranet.iq.base.actions.SecuredBaseAction:113) - remote user=QAS\allistairc
2004-08-03 14:49:08,839 -  INFO (com.qas.newmedia.intranet.iq.base.actions.SecuredBaseAction:113) - remote user=QAS\allistairc

As you see, the previous log entry has been lost.

Even if this worked, and the new logging was appended to the existing log, if every single rollOver fails (as in my case) I am going to quickly get to the state where my logs are unmanageable. There must be an underlying problem to this locking.

Cheers, Allistair.


> -----Original Message-----
> From: Ceki Gülcü [mailto:ceki@qos.ch]
> Sent: 03 August 2004 14:44
> To: Log4J Users List
> Subject: RE: Commons Logging breaks with log4j.1.3 alpha -> Caused by:
> java.lang.NoSuchFieldError: DEBUG
> 
> 
> 
> The error message might still be there indicating that 
> renaming/rolling of 
> the log file failed. However, contrary to previous behavior, 
> the logs from 
> the old file will not be discarded. Log4j will keep appending to the 
> existing file instead of discarding the old file and starting over.
> 
> Do you see the difference?
> 
> At 02:15 PM 8/3/2004, Allistair Crossley wrote:
> >Thanks .. that worked. However, the fixes in 1.3 do not fix 
> my problem 
> >with log renaming...
> >
> >** End of LogManager static initializer
> >log4j:ERROR Failed to rename 
> >[d:/jakarta-tomcat-5.0.25/logs/sys-authentication.log] to 
> >[d:/jakarta-tomcat-5.0.25/logs/sys-authentication.log.2004-08
> -03-12-46].
> >
> >*sigh*
> 
> -- 
> Ceki Gülcü
> 
>       For log4j documentation consider "The complete log4j manual"
>       ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp  
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 


<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
-------------------------------------------------------
QAS Ltd.
Developers of QuickAddress Software
<a href="http://www.qas.com">www.qas.com</a>
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>


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


RE: Commons Logging breaks with log4j.1.3 alpha -> Caused by: java.lang.NoSuchFieldError: DEBUG

Posted by Ceki Gülcü <ce...@qos.ch>.
At 03:53 PM 8/3/2004, you wrote:
>Hi Ceki,
>
>When the error occurs, the log is actually wiped clear and all previous 
>logging is lost. I have retested this to make sure I am not leading you astray.
>
>I have a log called sys-authentication.log for example which I have setup 
>to roll every minute as follows;
>
>log4j.logger.Authentication=debug, AuthenticationA
>log4j.appender.AuthenticationA=org.apache.log4j.DailyRollingFileAppender

You need to use o.a.l.rolling.RollingFileAppender which can only be 
configured using JoranConfigurator (new in log4j 1.3).

If you need to keep using org.apache.log4j.DailyRollingFileAppender, the 
change the following lines of code:


From:

     File file = new File(fileName);
     boolean result = file.renameTo(target);

     if (result) {
       LogLog.debug(fileName + " -> " + scheduledFilename);
     } else {
       LogLog.error(
         "Failed to rename [" + fileName + "] to [" + scheduledFilename + 
"].");
     }

to:

    org.apache.log4j.rolling.helpers.Util.rename(fileName, target);


that should fix it.


-- 
Ceki Gülcü

      For log4j documentation consider "The complete log4j manual"
      ISBN: 2970036908 http://www.qos.ch/shop/products/clm_t.jsp  



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