You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by epic winter <ep...@hotmail.com> on 2007/11/12 21:42:25 UTC

file location - windows vista

I have an application using log4j and in the past I have just specified: log4j.appender.file.File=logfilename.log

This would create the file in the location where the java app was launched.  This was in C:\program files\MyApp\logfilename.log

But windows vista doesn't seem to allow my program to write anywhere in c:\program files.  I assume that log file is not being written at all now because of these permissions.  Correct?

I guess my solution is to write the log file to a folder in the user's home directory.  Is there a way to auto specify the user's home directory without hard coding it?

thanks
-ryan

_________________________________________________________________
Help yourself to FREE treats served up daily at the Messenger Café. Stop by today.
http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline

RE: file location - windows vista

Posted by epic winter <ep...@hotmail.com>.
Thanks you guys I got it.

> From: carnold@apache.org
> Subject: Re: file location - windows vista
> Date: Tue, 13 Nov 2007 11:47:11 -0600
> To: log4j-user@logging.apache.org
> 
> 
> On Nov 13, 2007, at 9:55 AM, James A. N. Stauffer wrote:
> 
> > With an XML config you can access system properties like ${user.home$
> > }/logfilename.log
> >
> 
> 
> I don't think the trailing $ is necessary and would expect that would  
> actually break things, but I'm not sure.  System property  
> substitution also works with the property configurator.  See the JDK  
> documentation for System.getProperties() (http://java.sun.com/javase/ 
> 6/docs/api/java/lang/System.html#getProperties()) for a list of  
> always available system properties.   Using ${java.io.tmpdir} would  
> also be an option.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 

_________________________________________________________________
Windows Live Hotmail and Microsoft Office Outlook – together at last.  Get it now.
http://office.microsoft.com/en-us/outlook/HA102225181033.aspx?pid=CL100626971033

Re: file location - windows vista

Posted by "James A. N. Stauffer" <st...@gmail.com>.
That was a typo on my part.  It should have been ${user.home
}/logfilename.log

On Nov 13, 2007 11:47 AM, Curt Arnold <ca...@apache.org> wrote:

>
> On Nov 13, 2007, at 9:55 AM, James A. N. Stauffer wrote:
>
> > With an XML config you can access system properties like ${user.home$
> > }/logfilename.log
> >
>
>
> I don't think the trailing $ is necessary and would expect that would
> actually break things, but I'm not sure.  System property
> substitution also works with the property configurator.  See the JDK
> documentation for System.getProperties() (http://java.sun.com/javase/
> 6/docs/api/java/lang/System.html#getProperties()) for a list of
> always available system properties.   Using ${java.io.tmpdir} would
> also be an option.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
James A. N. Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/

Re: file location - windows vista

Posted by Curt Arnold <ca...@apache.org>.
On Nov 13, 2007, at 9:55 AM, James A. N. Stauffer wrote:

> With an XML config you can access system properties like ${user.home$
> }/logfilename.log
>


I don't think the trailing $ is necessary and would expect that would  
actually break things, but I'm not sure.  System property  
substitution also works with the property configurator.  See the JDK  
documentation for System.getProperties() (http://java.sun.com/javase/ 
6/docs/api/java/lang/System.html#getProperties()) for a list of  
always available system properties.   Using ${java.io.tmpdir} would  
also be an option.


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: file location - windows vista

Posted by "James A. N. Stauffer" <st...@gmail.com>.
With an XML config you can access system properties like ${user.home$
}/logfilename.log

On Nov 12, 2007 2:42 PM, epic winter <ep...@hotmail.com> wrote:

>
> I have an application using log4j and in the past I have just specified:
> log4j.appender.file.File=logfilename.log
>
> This would create the file in the location where the java app was
> launched.  This was in C:\program files\MyApp\logfilename.log
>
> But windows vista doesn't seem to allow my program to write anywhere in
> c:\program files.  I assume that log file is not being written at all now
> because of these permissions.  Correct?
>
> I guess my solution is to write the log file to a folder in the user's
> home directory.  Is there a way to auto specify the user's home directory
> without hard coding it?
>
> thanks
> -ryan
>
> _________________________________________________________________
> Help yourself to FREE treats served up daily at the Messenger Café. Stop
> by today.
>
> http://www.cafemessenger.com/info/info_sweetstuff2.html?ocid=TXT_TAGLM_OctWLtagline




-- 
James A. N. Stauffer        http://www.geocities.com/stauffer_james/
Are you good? Take the test at http://www.livingwaters.com/good/