tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <>
Subject RE: Retrieving the context path from a standalone class
Date Thu, 08 Jan 2004 15:28:26 GMT
Quoting "Shapira, Yoav" <>:

> Howdy,
> >One way is by taking advantage of Tomcat's naming conventions with the
> >tempdir....
> >
> >         String tempdir =
> >           "" + context.getAttribute("javax.servlet.context.tempdir");
> >         int lastSlash = tempdir.lastIndexOf(File.separator);
> >
> >         if ((tempdir.length() - 1) > lastSlash) {
> >           logHomePropName = tempdir.substring(lastSlash + 1) +
> >".log.home";
> >         }
> Very tomcat-specific and subject to change ;)

Yep, that's why I don't use that anymore and use the second approach.

  But the 2nd approach is
> much better, as I mentioned using ServletContext#getResource is a good
> way to go.  As I was reading the code, I could swear I'd seen it before,
> and then I realized it's a paste from the log4j repository selector you
> wrote ;)

Yes, with your help :-)  

  (BTW how come we haven't moved it from log4j-sandbox to log4j
> for 1.3 yet?)

Not sure, but we will probably want to update it to work with Ceki's new 
configuration mechanism which is to replace the DOMConfigurator (what was it 
called again?) and also use the new watchdogs instead of configureAndWatch() 
(which is only used in cases where it is configured to be used *and* we detect 
that we have file system access to the configured [proposed] location of the 
log file).  However, I am unfamiliar with how these work, so any help on this 
effort would be appreciated.

For my purposes, I use a jar built off the unofficial 0.2 tagged version of the 
log4j-sandbox CVS code.  BTW, ContextJNDISelector has been moved to Log4j 
already.  I think we should also move the other optional appenders as well as 
the configuration stuff as they have been very useful (to me, at least).  I'd 
like to hear the opinions of some of the other developers on this before an 
alpha release of log4j-1.3.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message