tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Schultz <ch...@christopherschultz.net>
Subject Re: How can I access tomcat's logs using my jsp?
Date Sat, 04 Feb 2012 18:14:41 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André,

On 2/3/12 5:47 PM, André Warnier wrote:
> Caldarale, Charles R wrote:
>>> From: André Warnier [mailto:aw@ice-sa.com] 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.

Yes, but it won't serve the files you want. It will most likely serve
an empty directory (or it should). Tomcat will ignore the docBase (or
it should).

You might be able to use a VirtualWebappLoader with the virtual class
path set to ${catalina.base}/logs, but I'm not sure if the
DefaultServlet will be able to use that. I've never tried it.

Or, you could just write some code to read and dump the file(s)
yourself. I would probably have specific log file names that are
recognized and served rather than allowing the remote user to just
specify a filename and let them poke-around looking for whatever files
your webapp is willing to serve. Just ask for ../conf/server.xml and
we've got a problem unless you're very careful about sanitizing inputs.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk8tdZEACgkQ9CaO5/Lv0PDWyACeOWGjjgbzo0xxDOj/GzCBKuk1
9e4AoLhRqpnzTG6oeFSvbpRDJLAdNqsk
=zbVt
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message