tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pid *" <>
Subject Re: How can I access tomcat's logs using my jsp?
Date Sat, 04 Feb 2012 18:08:26 GMT
On 3 Feb 2012, at 22:47, "André Warnier" <> wrote:

> Caldarale, Charles R wrote:
>>> From: André Warnier []
>>> Subject: Re: How can I access tomcat's logs using my jsp?
>>> - you can create a webapp named "tomcat-logs" (or whatever), just by
>>> creating a new directory "tomcat-logs" (or whatever) under webapps.
>> Nope.
> Here I beg to differ. The statement above was entirely accurate.
> This application won't do anything, and even less what the OP wanted,
> but it will exist, and Tomcat will dispatch to it.

Not if the context XML file under Tomcat/conf/<hostname> has a docBase
pointing elsewhere, as you then describe below.


>>> - to protect access to it, you'll need a WEB-INF/web.xml, with some
>>> security/auth constraints, just like any other protected application.
>> That is needed.  However, this WEB-INF directory and consequently the WEB-INF/web.xml
file must be placed in Tomcat's log directory.
>>> - you will need a META-INF/context.xml, specifying as docBase, the
>>> directory where the logs really are.
>> Nope, that won't work; docBase is not allowed when the webapp is inside the <Host>
appBase directory.  The <Context> element must be placed in conf/Catalina/[hostName]/[appName].xml,
with the docBase pointing to the location of the logs directory.
>>> - and you will need to specify somewhere, that for this directory,
>>> Tomcat is allowed to generate a page with an index to the files.
>> That's done by enabling the listings parameter for the DefaultServlet.  The OP will
need to copy the <servlet> tag and its sub-tags for the DefaultServlet from conf/web.xml
to the log webapp's WEB-INF/web.xml and set the listings parameter to true.  You do not want
to enable the listings parameter in the global conf/web.xml for what should be obvious reasons.
> Thanks for rectifying my sloppy suggestions and providing the accurate instructions.
> In my defense, I will argue that my suggestions were made with good intentions, that
> least the general idea was fine, and I will thus beg for the forgiveness of the court.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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

View raw message