Gbru Gbru -4 years ago 70
Java Question

Possible to change the an 'absolute' location in a .properties files?

Possible to change the an 'absolute' location in a .properties files?

For example if you look at the example below i need to change:

C:\\Users\\user1\\Desktop\\TestFramework
to the current projects folder using a dynamic locator, i know its possible in java using:
System.getProperty("user.dir")


log4j.appender.R.File=C:\\Users\\user1\\Desktop\\TestFramework\\log\\logFile.log
log4j.appender.TTCC.File=C:\\Users\\user1\\Desktop\\TestFramework\\log\\logFileSystemTime.log


Any ideas?

thanks

Answer Source

The file location can be a relative path.

log4j.appender.FILE.File=log/console.log

You can also use system properties

log4j.appender.FILE.File=${my.prop}/console.log
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download