im using log4j to write into a file with the following properties file :
log4j.rootLogger=DEBUG, FA #File Appender log4j.appender.FA=org.apache.log4j.FileAp
I would suggest as part of your build tool (Apache Ant or Maven) to take care of clearing the file you don't want. Alternatively if you want to keep a backup you can use the RollingFileAppender