Re: HTTP error response payload

2020-02-10 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Saurav,

On 2/8/20 1:47 AM, Saurav Sarkar wrote:
> Hi All,
> 
> Through tomcat access valve i can view the HTTP request url
> ,response code etc.
> 
> But i can not view the error response being sent in the form of
> JSON payload.
> 
> Is their any valve/filter/ any other setting on tomcat level which
> can enable this or applications (server and clients) themselves
> have to log it.

Are you asking if you can log the response body to a log file?

There are no components which ship with Tomcat that can do that
directly, but you could write your own Filter to siphon-off a copy of
the response to a file somewhere. Be aware that the log file is likely
to grow enormously in a short period of time. You may want to put some
kind of filtering on which responses you want to log.

- -chris
-BEGIN PGP SIGNATURE-
Comment: Using GnuPG with Thunderbird - https://www.enigmail.net/

iQIzBAEBCAAdFiEEMmKgYcQvxMe7tcJcHPApP6U8pFgFAl5BbtgACgkQHPApP6U8
pFglDg//cv4BxQ/hgmQDl3LFHxSWBxuBJTMIOSlKZ8NuFefxMF9dDwquWKnGAZ8q
7bKA1GXBJSZa6GMEgjmk4keIeaYasli7K3+wxpt61eAxg3GQwCnW1UGZ9BqStDQS
q68UQRmohNVvMIcjlhd1n7Si+Xh00C9go84pwlGJ1DpydDn6ziwam1TYLA/l2gI3
Dr1r4BIbj8oMSwr/Pd+80EZu/Is6dI617Jh5KjGZE+HGHnCum7tBySnRCyd+yktg
w+mjikWslczu21IzoOkvtZDfwFC1iSBK3MOO7JWOHCCRsjFTREL/0LjaP0t6kp7A
EtxTWAKBs4eorwyXcgWK3zAazgsIzbnhWPg9Rlc/188wcKG2cPldW3amJBsziOjQ
TGJ5M5Uyt37xvP0JE4Rz9TwJjm2bx4Bnjsa7jd/N+8PtY9Zr2rqb75vECWKw03tz
TBe65t+XFNyaKqtS7nEDaFkHM/NyaQo5YGXtAza4yTiz2xb1GK0j6R37XrtgC9aL
vFPzy8mUy7hi+U4Ygi+irsavH+qq/vFH+pSoE8qAb1lTnp3VBsU7JI37J3f5Au0i
5TeuOqEolQK4WMShMfV83g2R5M9Cv4PZWl2yyI7N3PnnTYUYKWwbCiQ/hNGTgkQW
p7BpftCQhaPs/UZ2pUl2ShNOJO6KYcGeA7rhXCnLPZtFk3nGiMQ=
=XLSH
-END PGP SIGNATURE-

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



Re: HTTP error response payload

2020-02-08 Thread tomcat-lists
Hi Saurav,

On 08.02.20 07:47, Saurav Sarkar wrote:
> Through tomcat access valve i can view the HTTP request url ,response code
> etc.
> 
> But i can not view the error response being sent in the form of JSON
> payload.
> 
> Is their any valve/filter/ any other setting on tomcat level which can
> enable this or applications (server and clients) themselves have to log it.

Logging HTTP request or response bodies in access logs (or similar) is not 
common as this can
be anything from a simple (short) string to long binary data. If you need 
specific errors, I
would suggest to log it in your application specific logs (you can add session 
id "%S" or other
identifiers to your access log for easier mapping, see 
https://tomcat.apache.org/tomcat-9.0-doc/config/valve.html#Access_Log_Valve
for details).

If you do not have a chance to add this to your logs you can implement a 
ServletFilter which logs
the body of requests for certain requests.

hth,
Thomas

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



HTTP error response payload

2020-02-07 Thread Saurav Sarkar
Hi All,

Through tomcat access valve i can view the HTTP request url ,response code
etc.

But i can not view the error response being sent in the form of JSON
payload.

Is their any valve/filter/ any other setting on tomcat level which can
enable this or applications (server and clients) themselves have to log it.


Best Regards,
Saurav