[prev in list] [next in list] [prev in thread] [next in thread] 

List:       logback-user
Subject:    Re: [logback-user] How to save logs in home directory of application
From:       Donald McLean <dmclean62 () gmail ! com>
Date:       2015-01-20 12:38:48
Message-ID: CA+W6VsY6Kz-BDxBYTxeq_LuX2_NW5k5CQnS5CBRY-NWDa35x4A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Martin,

The form

<file>logname.log</file>

will put the file in the "current directory" of the running application.
What directory that is will vary from OS to OS and may depend on
circumstances. It will often be the user home directory.

Java doesn't specifically support the idea of an "application", so unless
you create the application in a way where you set up a variable
specifically as you mentioned, I suspect the best you can do is to look at
the system variable "java.class.path" which could have several values, but
it will have the location of the application JAR.


Donald

On Tue, Jan 20, 2015 at 5:46 AM, Mejmoo <mejmoo@gmail.com> wrote:

> Hi,
>
> I need very simple thing. I need to put any logs from file appender to the
> file in application directory, where jar is located. (this is Java desktop
> application). If I define it explicitly it works:
>
> <file>C:\logname.log</file>
>
> but this does not work
>
> <file>logname.log</file>
>
> I know I can pass some variable to java interpreter and use it as
> ${LOGHOME} and then use it like
>
> <file>${LOGHOME}/logname.log</file>
>
> but it is really needed? Thanks, Martin
>
> _______________________________________________
> Logback-user mailing list
> Logback-user@qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>



-- 
Family photographs are a critical legacy for
ourselves and our descendants. Protect that
legacy with a digital backup and recovery plan.

[Attachment #5 (text/html)]

<div dir="ltr"><div><div><div><div><div>Hi Martin,<br><br></div>The \
form<br><br></div>&lt;file&gt;logname.log&lt;/file&gt;<br><br></div>will put the file \
in the &quot;current directory&quot; of the running application. What directory that \
is will vary from OS to OS and may depend on circumstances. It will often be the user \
home directory.<br><br></div>Java doesn&#39;t specifically support the idea of an \
&quot;application&quot;, so unless you create the application in a way where you set \
up a variable specifically as you mentioned, I suspect the best you can do is to look \
at the system variable &quot;<code>java.class.path&quot; which could have several \
values, but it will have the location of the application \
JAR.<br><br><br></code></div><code>Donald</code></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 20, 2015 at 5:46 AM, \
Mejmoo <span dir="ltr">&lt;<a href="mailto:mejmoo@gmail.com" \
target="_blank">mejmoo@gmail.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I need very simple \
thing. I need to put any logs from file appender to the file in application \
directory, where jar is located. (this is Java desktop application). If I define it \
explicitly it works:</div><div><br></div>&lt;file&gt;C:\logname.log&lt;/file&gt;<div><br></div><div>but \
this does not work</div><div><br></div><div>&lt;file&gt;logname.log&lt;/file&gt;</div><div><br></div><div>I \
know I can pass some variable to java interpreter and use it as ${LOGHOME} and then \
use it like</div><div><br></div><div>&lt;file&gt;${LOGHOME}/logname.log&lt;/file&gt;<br></div><div><br></div><div>but \
it is really needed? Thanks, Martin</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><br \
clear="all"><br>-- <br><div class="gmail_signature">Family photographs are a critical \
legacy for<br>ourselves and our descendants. Protect that<br>legacy with a digital \
backup and recovery plan.</div> </div>



_______________________________________________
Logback-user mailing list
Logback-user@qos.ch
http://mailman.qos.ch/mailman/listinfo/logback-user

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic