Logging using log4j - change the log file after every 1MB of Size
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   vivek_puranik
Posted On:   Monday, August 29, 2005 08:49 AM

Hi,
There is a requirement in our project, that use log4j to log the events,exceptions, etc. to a certain log file until its size is 1MB. Then use another log file to write the logs. (and so on)
How can this be done.
I am a newbie to log4J and don't know much about it..
We are working on J2SE 1.4.2 and our program is a simple java application which fetches data from database and migrates it to another database.

Re: Logging using log4j - change the log file after every 1MB of Size

Posted By:   sangeetha_Rao  
Posted On:   Thursday, September 8, 2005 12:18 AM

Vivek, this properties file will serve ur purpose:

-----------------------------------------------------------
log4j.rootLogger=debug, R
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=example.log
log4j.appender.R.MaxFileSize=1MB
# Keep three backup file
log4j.appender.R.MaxBackupIndex=3
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
-----------------------------------------------------------
About | Sitemap | Contact