<div dir="ltr">Thanks again, Tony.<div><br></div><div style>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.</div>
<div style><br></div><div style>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?</div>
<div style><br></div><div style>Thanks.</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 19, 2013 at 9:15 PM, Tony Trinh <span dir="ltr"><<a href="mailto:tony19@gmail.com" target="_blank">tony19@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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.<div>
<br></div>
<div>An alternative is to use an absolute path to a designated "data" directory (with environment variables). For example:</div><div><br></div><div> <property file="${HOME}/.myapp/log.properties" /><br>
</div>
<div> <property file="${APPDATA}/.myapp/log.properties" /><br></div><div> <property file="${PROGRAMFILES}/MyApp/log.properties" /><br></div>
<div><br></div><div><br></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Apr 19, 2013 at 9:22 PM, Suriyanto <span dir="ltr"><<a href="mailto:suriyanto@gmail.com" target="_blank">suriyanto@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks for answering.<div><br></div><div>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.</div>
<div><br></div><div>/dir</div><div> myapp.jar</div><div> log.properties</div><span><font color="#888888"><div><br></div><div>Suriyanto</div></font></span></div><div><div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Fri, Apr 19, 2013 at 7:00 PM, Tony Trinh <span dir="ltr"><<a href="mailto:tony19@gmail.com" target="_blank">tony19@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">If the file is in your JAR, you should be using the "resource" attribute instead of "file" (which searches your host filesystem).<div>
<br></div><div><font face="courier new, monospace"> <property resource="log.properties" /></font></div>
</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div>On Fri, Apr 19, 2013 at 8:39 PM, Suriyanto <span dir="ltr"><<a href="mailto:suriyanto@gmail.com" target="_blank">suriyanto@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><div dir="ltr">Hello,<div><br></div><div>I am following the instruction in the Logback manual to use an external property file.</div>
<div><br></div><div><property file="log.properties" /><br>
</div><div><br></div><div>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.</div><div><br></div><div>However, I keep getting the error: ERROR in ch.qos.logback.core.joran.action.PropertyAction - Could not find properties file [log.properties].</div>
<div><br></div><div>Am I putting the file in the correct directory?</div><div><br></div><div>Thanks,</div><div>Suriyanto</div></div>
<br></div></div>_______________________________________________<br>
Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch" target="_blank">Logback-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a><br></blockquote></div><br></div>
<br>_______________________________________________<br>
Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch" target="_blank">Logback-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a><br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch" target="_blank">Logback-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a><br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
Logback-user mailing list<br>
<a href="mailto:Logback-user@qos.ch">Logback-user@qos.ch</a><br>
<a href="http://mailman.qos.ch/mailman/listinfo/logback-user" target="_blank">http://mailman.qos.ch/mailman/listinfo/logback-user</a><br></blockquote></div><br></div>