Thanks again, Tony. Yes, if I use absolute path, it will work. However I want to use the relative path so the user can put the jar and properties file anywhere as long as they are put in the same directory.
I tried to cd to dir and run from there, but logback still tells me that it cannot find the properties file. Is there a way for me to know what the absolute mapping that logback use when I provide a relative path? Thanks. On Fri, Apr 19, 2013 at 9:15 PM, Tony Trinh <[email protected]> wrote: > Ok. The file-lookup is relative to your current working directory (unless > you use absolute paths). You can confirm by cd'ing into /dir and then > invoking your jar. > > An alternative is to use an absolute path to a designated "data" directory > (with environment variables). For example: > > <property file="${HOME}/.myapp/log.properties" /> > <property file="${APPDATA}/.myapp/log.properties" /> > <property file="${PROGRAMFILES}/MyApp/log.properties" /> > > > > > On Fri, Apr 19, 2013 at 9:22 PM, Suriyanto <[email protected]> wrote: > >> Thanks for answering. >> >> I actually wanted to put the file outside the jar so the user can easily >> modify it for any of their environment. The file will be on the same >> directory as the jar file. >> >> /dir >> myapp.jar >> log.properties >> >> Suriyanto >> >> >> On Fri, Apr 19, 2013 at 7:00 PM, Tony Trinh <[email protected]> wrote: >> >>> If the file is in your JAR, you should be using the "resource" attribute >>> instead of "file" (which searches your host filesystem). >>> >>> <property resource="log.properties" /> >>> >>> >>> On Fri, Apr 19, 2013 at 8:39 PM, Suriyanto <[email protected]> wrote: >>> >>>> Hello, >>>> >>>> I am following the instruction in the Logback manual to use an external >>>> property file. >>>> >>>> <property file="log.properties" /> >>>> >>>> I have log.properties file in the same directory as my executable jar >>>> file, which are created as an uber jar file from Maven plugin. >>>> >>>> However, I keep getting the error: ERROR in >>>> ch.qos.logback.core.joran.action.PropertyAction - Could not find properties >>>> file [log.properties]. >>>> >>>> Am I putting the file in the correct directory? >>>> >>>> Thanks, >>>> Suriyanto >>>> >>>> _______________________________________________ >>>> Logback-user mailing list >>>> [email protected] >>>> http://mailman.qos.ch/mailman/listinfo/logback-user >>>> >>> >>> >>> _______________________________________________ >>> Logback-user mailing list >>> [email protected] >>> http://mailman.qos.ch/mailman/listinfo/logback-user >>> >> >> >> _______________________________________________ >> Logback-user mailing list >> [email protected] >> http://mailman.qos.ch/mailman/listinfo/logback-user >> > > > _______________________________________________ > Logback-user mailing list > [email protected] > http://mailman.qos.ch/mailman/listinfo/logback-user >
_______________________________________________ Logback-user mailing list [email protected] http://mailman.qos.ch/mailman/listinfo/logback-user
