Question

I have a .properties file that defines the path in which my logfile is being saved. The question is simple but I'm struggling to find the solution. My directory looks like this:

   -MyBundle
     --configuration
           config.properties
     --log
           logfile.log
     --src

How can I define the path to "logfile" inside the config.properties file?

Thanks in advance.

Was it helpful?

Solution

logFile.log is at "../log/logFile.log" relative to "config.properties"

The .. notation references the directory that contains ., which is the current directory.

http://en.wikipedia.org/wiki/Path_(computing)

OTHER TIPS

In case your bundle is executed as a separated process, let suppose it would be a .jar file; you should access to relative path considering the "current working directory".

In your case I suppose, "log/logFile.log" should be set in the configuration file.

Futhermore, I would point out you can know you "current working directory" by checking system property user.dir

System.getProperty("user.dir")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top