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 Zsolt <zk...@intland.com> on 2006/02/07 12:50:58 UTC

How to use relative filename in log4j.properties?

Hi,

I use logging-log4j-1.2.13 from tomcat-5.5.15. How can I use relative
filenames to get the log files under tomcat/logs?

Zsolt



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


Re: How to use relative filename in log4j.properties?

Posted by Jacob Kjome <ho...@visi.com>.
I second James' suggestion.  However, if you really want to use relative paths,
then you need to know what directory the VM is starting from.  This depends on
how you are starting Tomcat.  I'll assume you are using plain vanilla Tomcat,
not Tomcat bundled with JBoss or some other such package.

If you are starting using the .bat or .sh files, then (unless something's
changed recently), the VM should start from the CATALINA_HOME/bin directory. 
So, in your config file, you could refer to the logs directory using...

../logs/some.log

However, if you are using something like the Windows service, this does not
start the VM from the CATALINA_HOME/bin directory, but from the
C:\WINNT\system32 directory (You'll have to double check this, but I think this
is the default for Windows).  You can solve this issue by adding the following
to service.bat and then do a "service remove" and then "service install"...

set PR_STARTPATH=%CATALINA_HOME%\bin
set PR_STOPPATH=%CATALINA_HOME%\bin

That will normalize behavior to be equivalent to running from the .bat or .sh
files.


Jake

Quoting James Stauffer <st...@gmail.com>:

> Use something like:
> ${catalina.home}/logs/some.log
>
> On 2/7/06, Zsolt <zk...@intland.com> wrote:
> > Hi,
> >
> > I use logging-log4j-1.2.13 from tomcat-5.5.15. How can I use relative
> > filenames to get the log files under tomcat/logs?
> >
> > Zsolt
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
>
> --
> James Stauffer
> Are you good? Take the test at http://www.livingwaters.com/good/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>




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


RE: How to use relative filename in log4j.properties?

Posted by Jacob Kjome <ho...@visi.com>.
Quoting Zsolt <zk...@intland.com>:

> If that worked I would use it:
> >${catalina.home}/logs/some.log
>

Have you set CATALINA_HOME as an OS environment variable?  That's what Tomcat's
.bat and .sh batch startup files, and service.bat Windows service installer use
to set the value for catalina.home.

Jake


> Zsolt
>
> >
> >On 2/7/06, Zsolt <zk...@intland.com> wrote:
> >> Hi,
> >>
> >> I use logging-log4j-1.2.13 from tomcat-5.5.15. How can I use relative
> >> filenames to get the log files under tomcat/logs?
> >>
> >> Zsolt
> >>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> >> For additional commands, e-mail: log4j-user-help@logging.apache.org
> >>
> >>
> >
> >
> >--
> >James Stauffer
> >Are you good? Take the test at http://www.livingwaters.com/good/
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> >For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>




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


RE: How to use relative filename in log4j.properties?

Posted by Zsolt <zk...@intland.com>.
If that worked I would use it:
>${catalina.home}/logs/some.log

Zsolt

>
>On 2/7/06, Zsolt <zk...@intland.com> wrote:
>> Hi,
>>
>> I use logging-log4j-1.2.13 from tomcat-5.5.15. How can I use relative
>> filenames to get the log files under tomcat/logs?
>>
>> Zsolt
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>>
>>
>
>
>--
>James Stauffer
>Are you good? Take the test at http://www.livingwaters.com/good/
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>For additional commands, e-mail: log4j-user-help@logging.apache.org


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


Re: How to use relative filename in log4j.properties?

Posted by James Stauffer <st...@gmail.com>.
Use something like:
${catalina.home}/logs/some.log

On 2/7/06, Zsolt <zk...@intland.com> wrote:
> Hi,
>
> I use logging-log4j-1.2.13 from tomcat-5.5.15. How can I use relative
> filenames to get the log files under tomcat/logs?
>
> Zsolt
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


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

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