You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Keith Hawkridge <Ke...@caplin.com> on 2006/12/18 13:24:57 UTC

logging the all the request/response http messages for my application

Hi, I have an application setup via a context and I want to view all the
http request/response messages that deals with this context.

 

Is there any easy way to set this up with tomcats logging?

 

Thanks in advance,

 

Keith


Re: logging the all the request/response http messages for my application

Posted by David Delbecq <de...@oma.be>.
Either use the requestdumper valve provided by tomcat (to dump headers
and form submission)
Either create a ServletFilter that will decorate the HttpServletRequest
and the HttpServletResponse and forward those decorated object to the
followup of processing chain
(http://java.sun.com/products/servlet/Filters.html).
In the decoration put code to output somewhere the result as it's
writent to the response outputstream by servlet.

Keith Hawkridge a écrit :
> Hi, is it possible to give me an answer for both?
>
> keith
>
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: 18 December 2006 14:35
> To: Tomcat Users List
> Subject: Re: logging the all the request/response http messages for my
> application
>
> Keith,
>
> Keith Hawkridge wrote:
> > Hi, I have an application setup via a context and I want to view all
> the
> > http request/response messages that deals with this context.
>
> > Is there any easy way to set this up with tomcats logging?
>
> Do you want to log all of the HTTP headers and parameters, or do you
> want to log all of the content, too?
>
> Logging the headers and parameters is pretty easy (including the headers
> being returned in the response). The most obvious way is to write a
> filter that just dumps that information wherever you want it. Some of
> Tomcat's valves may help (such as the RequestDumperValve -
> http://tomcat.apache.org/tomcat-5.0-doc/catalina/docs/api/org/apache/cat
> alina/valves/RequestDumperValve.html).
>
> If you want to log all of the content, then your job becomes more
> difficult, because the content of a request cannot be read twice. In
> order to capture and log the content, your filter will have to wrap the
> request and response in specialized objects that will serve that content
> out of buffers held for the purposes of allowing that data to be read
> multiple times. If you don't do this, some of your code may stop
> working.
>
> Good luck,
> -chris
>

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


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




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


Re: logging the all the request/response http messages for my application

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Keith,

Keith Hawkridge wrote:
> Hi, is it possible to give me an answer for both?

I'm not sure what you mean. Do you want an implementation for a
re-readable request and a sniffable response? I'm unlikely to write that
for you without being paid ;)

I'm guessing that the RequestDumperValve will be enough for your
purposes, though.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFhrPX9CaO5/Lv0PARAu8uAKC5Z1qLSZfH1hxcUZX59iSRJMfAQwCgv/4v
egIODd+Aw+BbQ1QMqLplwyQ=
=NEoH
-----END PGP SIGNATURE-----

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


RE: logging the all the request/response http messages for my application

Posted by Keith Hawkridge <Ke...@caplin.com>.
Hi, is it possible to give me an answer for both?

keith

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net] 
Sent: 18 December 2006 14:35
To: Tomcat Users List
Subject: Re: logging the all the request/response http messages for my
application

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Keith,

Keith Hawkridge wrote:
> Hi, I have an application setup via a context and I want to view all
the
> http request/response messages that deals with this context.
> 
> Is there any easy way to set this up with tomcats logging?

Do you want to log all of the HTTP headers and parameters, or do you
want to log all of the content, too?

Logging the headers and parameters is pretty easy (including the headers
being returned in the response). The most obvious way is to write a
filter that just dumps that information wherever you want it. Some of
Tomcat's valves may help (such as the RequestDumperValve -
http://tomcat.apache.org/tomcat-5.0-doc/catalina/docs/api/org/apache/cat
alina/valves/RequestDumperValve.html).

If you want to log all of the content, then your job becomes more
difficult, because the content of a request cannot be read twice. In
order to capture and log the content, your filter will have to wrap the
request and response in specialized objects that will serve that content
out of buffers held for the purposes of allowing that data to be read
multiple times. If you don't do this, some of your code may stop
working.

Good luck,
- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFhqcm9CaO5/Lv0PARAkmiAKCa3A+CdzJ/DfdVkczWe+xjzHGTmACfToNh
ExJBjDrc3xAP0GgeciBAuSw=
=PKuv
-----END PGP SIGNATURE-----

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


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


Re: logging the all the request/response http messages for my application

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Keith,

Keith Hawkridge wrote:
> Hi, I have an application setup via a context and I want to view all the
> http request/response messages that deals with this context.
> 
> Is there any easy way to set this up with tomcats logging?

Do you want to log all of the HTTP headers and parameters, or do you
want to log all of the content, too?

Logging the headers and parameters is pretty easy (including the headers
being returned in the response). The most obvious way is to write a
filter that just dumps that information wherever you want it. Some of
Tomcat's valves may help (such as the RequestDumperValve -
http://tomcat.apache.org/tomcat-5.0-doc/catalina/docs/api/org/apache/catalina/valves/RequestDumperValve.html).

If you want to log all of the content, then your job becomes more
difficult, because the content of a request cannot be read twice. In
order to capture and log the content, your filter will have to wrap the
request and response in specialized objects that will serve that content
out of buffers held for the purposes of allowing that data to be read
multiple times. If you don't do this, some of your code may stop working.

Good luck,
- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFhqcm9CaO5/Lv0PARAkmiAKCa3A+CdzJ/DfdVkczWe+xjzHGTmACfToNh
ExJBjDrc3xAP0GgeciBAuSw=
=PKuv
-----END PGP SIGNATURE-----

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