tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven J. Owens" <>
Subject Re: Best Logging practices
Date Wed, 19 Feb 2003 21:27:51 GMT
On Wed, Feb 19, 2003 at 08:15:20AM -0600, Jacob Kjome wrote:
> Don't count on being able to write to anywhere within your webapp.  Tomcat, 
> by default, expands your webapp to a directory and deploys your app from 
> there.  This gives you access to within your webapp via File IO.  However, 
> this is not guaranteed by the servlet spec.  Your app can be run directly 
> from the .war archive where you will have no File system access within the 
> webapp structure.  So, either provide some configuration for logging to a 
> directory outside the webapp and allow the setting to be modifiable in the 
> deployment configuration (such as a nested <Parameter> in a Tomcat 
> <Context> entry) or do your logging to console or some other non-File 
> appender.

     This is something that's bugged me for quite a while (in fact,
since jars were introduced :-).  There's no way, as far as I'm aware,
to elegantly handle configurable files inside the jar, nor to handle
writable data inside the webapp jar.

     One thought though; for web applications you're supposed to get
external resources by configuring them in the web.xml and using
ServletContext.getResourceAsStream().  This only supports input
streams, but I've always sort of felt it should support output streams
as well.  Or that there should be some similar mechanism, so that at
least the point where you're crossing the web application boundary is
explicitly and clearly defined in a standard central location for such

Steven J. Owens

"I'm going to make broad, sweeping generalizations and strong,
 declarative statements, because otherwise I'll be here all night and
 this document will be four times longer and much less fun to read.
 Take it all with a grain of salt." - Me at

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

View raw message