tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Writing exception trace to a file
Date Tue, 02 May 2000 16:35:02 GMT
Chris Howard wrote:

> > To avoid inadvertent requests of your trace logs, one option would be to
> store
> > the trace file under the "WEB-INF" directory, which the servlet container
> is
> > expressly prohibited from serving via requests.  You could do something
> like
> > this:
> >
> >     String tracePathname =
> > getServletContext().getRealPath("/WEB-INF/tracefile.txt");
> >     PrintWriter traceWriter = new PrintWriter(new
> FileWriter(tracePathname));
> >     traceWriter.println(...);
> I like this idea but the problem I have is that I will have multiple
> instances of the jsp app running from multiple directories.  I would like 1
> log file for each instance.  Maybe I could tack on some directory
> information to the log file name.

Are you running the multiple instances as separate web applications (i.e.
separate directories under $TOMCAT_HOME/webapps or separate <Context> entries
in conf/server.xml?  If you are, then you've already got separate directories
for each app -- each has their own WEB-INF area.  If you are running all of
your "apps" in a single context, then you'll definitely need to add something
unique to the log file names for each.  My point was that you can avoid any
chance that someone could try to snoop your exception trace files if you store
them under WEB-INF.

> Thanks again,
> Chris


View raw message