AFAIK you don't have to call rollover() in your code.

The appender works it out for you.

It will automatically roll the files when they reach a certain size.

>>> [EMAIL PROTECTED] 04/06/01 01:44am >>>
Hi ,

i set MaxBackupIndex=1 , but i didn't get any backup file.
even if i set MaxBackupIndex=2 i didn't any backup file.
I don't Know is it is my mistake or a bug
Waht have i to do for getting the BacKup in addition to set the  MaxBackupIndex and 
call the rollOver() method
form RollingFileAppender

Thanks for the help..

Simin

If you want more, set MaxBackupIndex=10, and you will end up with 10 files:




An:     log4j-user%jakarta.apache.org
Kopie:  
Blindkopie:     Simin Zolfaghari
Thema:  Betr.: Re: where is the backup file
_______________________________________________________________________________________________________________________________________

Von:    SCOTT.FARQUHAR%sydneywater.com.au @ Internet
Datum:  05.04.2001 03:29

Reply-To: log4j-user%jakarta.apache.org@Internet

If you set MaxBackupIndex=1 , then you will only get one backup file.

If you want more, set MaxBackupIndex=10, and you will end up with 10 files:

log.1
log.2
...
log.10

>>> [EMAIL PROTECTED] 04/04/01 08:52pm >>>
I have set the MaxBackupIndex of one ,  (two and tree ..) in the Config-file
log4j.appender.A1.MaxBackupIndex=1

I call the rollOver() in my applikation-code 
cat = Category.getInstance("CAT");
PropertyConfigurator.configure( c:/itp/logmpl/log-test.properties"));
RollingFileAppender  a =(RollingFileAppender)cat.getAppender("A1");
a.rollOver();

 and run my test_applikation. There was only one time a bakeupfile  with the name 
C:/itp/logImpl/logtest.log.1  
but not other more. Wenn i repeated  the test, it wasn't anymore  backeup file created 
and the exist bakeupFile C:/itp/logImpl/logtest.log.1   was disposed.
i don'nt know why only one time was the bakeup file created. 


Simin





An:     log4j-user%jakarta.apache.org
Kopie:  
Blindkopie:     Simin Zolfaghari
Thema:  Re: where is the backup file
_______________________________________________________________________________________________________________________________________

Von:    SCOTT.FARQUHAR%sydneywater.com.au @ Internet
Datum:  04.04.2001 00:54

Reply-To: log4j-user%jakarta.apache.org@Internet

>From the javaDoc on RollingFileAppender:
-----------------
rollOver
public void rollOver()
Implemetns the usual roll over behaviour. 
If MaxBackupIndex is positive, then files {File.1, ..., File.MaxBackupIndex -1} are 
renamed to 
{File.2, ..., File.MaxBackupIndex}. Moreover, File is renamed File.1 and closed. 
A new File is created to receive further log output. 

If MaxBackupIndex is equal to zero, then the File is truncated with no backup files 
created.

----------------------------
So your backup file would be 
C:/itp/logImpl/logtest.log.1


>>> [EMAIL PROTECTED] 04/04/01 12:36am >>>
Hi,

I have implemented a Simple class " LogImpl"  that included one Catagory  named "CAT".
I have to to specify a MaxFileSize and a Backupfile. The test-application with this 
Class run correctly but I
 don't know where is saved my Backup file and wath is the Name of the Backupfile .  
Is it possible to specify the name of the Backupfile?
I can't find any Backup file .

the Configuration file look like.


# Set root category priority to DEBUG and its only appender to A1.
log4j.rootCategory=DEBUG, A1
  

# A1 is set to be a FileAppender which outputs to test.log. 
#log4j.appender.A1=org.apache.log4j.FileAppender
log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.Append=true
log4j.appender.A1.File=C:/itp/logImpl/logtest.log
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c{1} %x - %m%n
  
log4j.appender.A1.MaxFileSize=10KB
# Keep one backup file
log4j.appender.A1.MaxBackupIndex=1

log4j.category.CAT=DEBUG



tanks,
Simin



___________________________________________________

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





___________________________________________________

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





___________________________________________________

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