[logback-user] How to save logs in home directory of application

Donald McLean dmclean62 at gmail.com
Tue Jan 20 13:38:48 CET 2015


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 at 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 at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20150120/52b0d6f9/attachment.html>


More information about the Logback-user mailing list