I recall someone asked this a while ago but I cannot locate the post. Anyway, there is no way to configure Log4J to limit the number of logs created with the DailyRollingFileAppender. The best you could do is write a script that deletes the oldest log file(s) and set that script to run automatically every day.
You could use a RollingFileAppender instead - it creates a new log file once the log file reaches a certain size, and you can tell it how many log files to retain.
Thanks For Quick reply. I will then need to use Sizebased appender, thanks.