My example was based on a properties file, but I think that should work equally well 
for an XML based log4j configuration.

Java doesn't have the concept of environment variables as they are platform dependent.

System property is always set using the -D command line option for "java vm" or 
programmatically using System.setProperty().

When you run tomcat, the catalina.home system property is automatically set during 
startup by the startup script files - if you are running tomcat from command line.

-----Original Message-----
From: Dorner, Thomas [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 03, 2004 9:28 AM
To: '[EMAIL PROTECTED]'
Subject: AW: log4j help pls

Hi Wagle,

Thanks for your reply.
Can you please explain me your example in detail?

Where should I set the system property - do you mean I should set a 
environment-variable "CATALINA_HOME"?

<appender name="client" class="org.apache.log4j.RollingFileAppender">
        <param name="File" value="${CATALINA_HOME}/logs/client.log"/>


log4j.appender.A2.File=${catalina.home}/logs/SystemSigner.log???


Some help?

Thanks Thomas

-----Ursprüngliche Nachricht-----
Von: Wagle, Shriniwas [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 3. November 2004 14:58
An: [EMAIL PROTECTED]
Betreff: RE: log4j help pls

The log4j properties file can handle system properties.  So you can use something like 
below to specify a path name.

log4j.appender.A2.File=${catalina.home}/logs/SystemSigner.log 

-----Original Message-----
From: Dorner, Thomas [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 03, 2004 8:14 AM
To: '[EMAIL PROTECTED]'
Subject: AW: log4j help pls

Hi Steve,

Thank you for your fast reply!

>If you are using from a WEB Context it will be a relative path from the 
>WEB-INF/ directory of your web context

I have a Web-Application with the following path:
C:\jakarta-tomcat-4.1.24\webapps\PDMWebConnector\WEB-INF\classes

My log4j.config runs in:
C:\jakarta-tomcat-4.1.24\webapps\PDMWebConnector\config\

So, if I want to log in:
C:\jakarta-tomcat-4.1.24\logs\
I had to define the relative path like this:
..\\..\\..\\logs\\appender.xml ????


Can you please tell me if I am right?
Or does it depends on the directory where log4j.config.xml was placed?

Thanks
Thomas





-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 3. November 2004 13:50
An: [EMAIL PROTECTED]
Betreff: Re: log4j help pls

The short answer is yes.

Don't put the absolute path name just a relative path name.

This has a affect depending on the context.

If it is a stand alone application it will be a relative path from the directory in 
which you started the application.

If you are using from a WEB Context it will be a relative path from the WEB- INF/ 
directory of your web context



Regards

Steve


Quoting "Dorner, Thomas" <[EMAIL PROTECTED]>:

> Hi all,
> 
>  
> 
> I am sorry for asking this non axis question, but I cant find a 
> solution whenn googling.
> 
>  
> 
> I use log4j in my project and so I have the log4j.config.xml and 
> therefore the appenders.
> 
> The appender do have a attribute name="File" and a value="C:\\..\\..\\"
with
> the absolute path,
> 
> Which define where log4j writes the log-file.
> 
>  
> 
> My question is, is it possible to define/describe a relativ path where
log4j
> write the log-file????
> 
>  
> 
>  
> 
> <appender name="webservices" 
> class="org.apache.log4j.RollingFileAppender">
> 
> <param name="File"
> value="C:\\projects\\sources\\PDMWebConnector\\logs\\webservices.log"/
> >
> 
>       <param name="MaxFileSize" value="1000KB"/>
> 
>  
> 
>  
> 
> Thanks in advance
> 
> Thomas
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 




Reply via email to