For example, the first time I run an application (or immediately after I clear out the /logs directory), I want log4j to write the application\'s logs to a file called log.0
May be this is what you are looking for
http://veerasundar.com/blog/2009/08/how-to-create-a-new-log-file-for-each-time-the-application-runs/
**Edit:**I got one more solution! But no idea whether it works or not,but you can try http://www.mail-archive.com/log4cxx-user@logging.apache.org/msg02132.html