In the properties file,we will have something like this.
log4j.appender.fileAppender=org.apache.log4j.FileAppenderYou will notice that we have a ${logFileName} in our properties file.This is meant to be substituted later.So when we run the application,we will type the following command
log4j.appender.fileAppender.File=logs/${logFileName}
log4j.appender.fileAppender.Append=false
log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.fileAppender.layout.ConversionPattern=%d [%-5p] %c{1} - %m%n
java -DlogFileName=20080104.log YourClassHappy programming. :)