RE: application path/docBase property

2004-07-29 Thread Shapira, Yoav
Hi,
See Jacob Kjome's contributions to the log4j sandbox at
http://cvs.apache.org/viewcvs.cgi/logging-log4j-sandbox/src/java/org/apa
che/log4j/ (servlet and selector packages).  People have been using them
in production for a long time now, all reporting success.  We will
probably put it in log4j 1.3 proper (i.e. promote it from the sandbox,
so it will be included in the default log4j distribution).

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 29, 2004 1:14 PM
To: [EMAIL PROTECTED]
Subject: application path/docBase property


   I'm trying to find the property that corresponds to either the
application path (i.e. the path attribute of the Context element), or
the installed path (i.e. the docBase attribute).  I haven't had any
luck
finding it.  Is there such a property?

   Specifically, what I am trying to do is have a application that
can
be installed to an arbitrary path use a common log4j properties file
and have the logs go to an appropriate log file.  Right now I'm working
around the problem by generating the log4j properties file at build
time,
but I'd prefer not to have to rebuild just to install to a new
location.

e.g., I'd like to be able to do something like this:
log4j.appender.MYLOG.File=${catalina.home}/logs/${application.path}.log
or even:
log4j.appender.MYLOG.File=${application.path}/WEB-INF/logs/application.
log

Any suggestions?

thanks,
eric


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: application path/docBase property

2004-07-29 Thread erh
On Thu, Jul 29, 2004 at 01:16:48PM -0400, Shapira, Yoav wrote:
 See Jacob Kjome's contributions to the log4j sandbox at
 http://cvs.apache.org/viewcvs.cgi/logging-log4j-sandbox/src/java/org/apa
 che/log4j/ (servlet and selector packages).  People have been using them
 in production for a long time now, all reporting success.  We will
 probably put it in log4j 1.3 proper (i.e. promote it from the sandbox,
 so it will be included in the default log4j distribution).

hmm.. not much documentation on how to use it, but from what I could 
gather it seems to set a property named application path.log.home.
That's not very useful when the application path isn't constant!
I suppose I can probably hard code it somewhere in that code.  More
trouble than I was hoping for, but it probably won't be too bad.

Thanks for the pointer.

eric

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Application Path

2000-12-08 Thread Jon Skeet

 Hello All,
 I have a question regarding application path in Tomcat. I have
 loaded and application named "myapp" under 'webapps' of Tomcat. Now, is it
 possible to know the full path of my application "myapp"?[i.e upto and including
 the folder 'myapp']

Within a request, use something like the following:

String requestURL = HttpUtils.getRequestURL (req).toString();
String path = req.getPathInfo();
if (path==null)
 servletURL=requestURL;
else
{
if (!requestURL.endsWith (path))
{
 // Panic and use something else... your choice!
}
else
servletURL = requestURL.substring (0, requestURL.length()-path.length());
}

Jon



RE: Application Path

2000-12-08 Thread Albert Chang -

String appPath = request.getRealPath("/");

-Original Message-
From: Saikat Chatterjee [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 08, 2000 5:17 PM
To: [EMAIL PROTECTED]
Subject: Application Path


Hello All,
I have a question regarding application path in Tomcat. I have
loaded and application named "myapp" under 'webapps' of Tomcat. Now, is it
possible to know the full path of my application "myapp"?[i.e upto and
including
the folder 'myapp']

Thanks in advance,

Saikat




RE: Application Path

2000-12-08 Thread Jon Skeet

   You can use the "getDocumentBase()" method to find the path/URL of your
 servlet. and/or "getCodeBase()" which gets the base URL.

No - both of those methods are for *applets*, not servlets.

Jon