You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Russ Kepler <ru...@kepler-eng.com> on 2012/11/26 19:27:21 UTC
Logging cookies in Tomcat 7
I'm running Tomcat 7 with juli logging enabled and so I'm seeing the standard
logfiles. In my access log I'm seeing the standard entries on each line and
I'd like to see the cookies being passed as well - is there an easy way to do
this - a property to set on the start up or something similar?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Logging cookies in Tomcat 7
Posted by Russ Kepler <ru...@kepler-eng.com>.
On Monday, November 26, 2012 12:05:45 PM Russ Kepler wrote:
> On Monday, November 26, 2012 01:44:25 PM Christopher Schultz wrote:
> > On 11/26/12 1:27 PM, Russ Kepler wrote:
> > > I'm running Tomcat 7 with juli logging enabled and so I'm seeing
> > > the standard logfiles. In my access log I'm seeing the standard
> > > entries on each line and I'd like to see the cookies being passed
> > > as well - is there an easy way to do this - a property to set on
> > > the start up or something similar?
> >
> > Do you need to be able to see arbitrary cookies, or do you have a
> > specific list of cookies for which you'd like to see values?
>
> I'm trying to see if I'm passing the right jsessionid from a Java Web Start
> application. I've found the AccessLogValve entry in the server.xml and
> added "%{jsessionid}c" to the log pattern. I'm not seeing anything added
> to the log output, adding some plaintext to the pattern showed that I was
> in the right neighborhood. I tried "%c" and got ???c???, so if there
> doesn't seem to be a general "print the cookies" pattern. I see a %S and
> that seems to be printing the session id but the session id seems to be
> changing between accesses:
Bad form replying to myself, but the cookie name seems to be case sensitive.
Changing the form to "%{JSESSIONID}c" seems to be printing the right cookie.
Here's the log using "%{JSESSIONID}c %S"
127.0.0.1 - webtyper [26/Nov/2012:12:11:12 -0700] "GET /WebTyper/Hello.jsp
HTTP/1.1" 0B9EA01DEAD73DB885183DEC535251B7 8953D71715F23F7528C0C70B384B3F44
200 470
127.0.0.1 - webtyper [26/Nov/2012:12:11:13 -0700] "GET /WebTyper/appload.jsp
HTTP/1.1" 8953D71715F23F7528C0C70B384B3F44 8953D71715F23F7528C0C70B384B3F44
200 814
127.0.0.1 - - [26/Nov/2012:12:11:13 -0700] "GET /WebTyper/app/Webtyper.jar
HTTP/1.1" - 9319C7008BC21C4894AF24C985B3F727 304 -
127.0.0.1 - - [26/Nov/2012:12:11:27 -0700] "POST
/WebTyper/data/json/typer/post HTTP/1.1" 9319C7008BC21C4894AF24C985B3F727
9319C7008BC21C4894AF24C985B3F727 403 1195
I still am getting 403 on the last access with what seems to be the right
session id.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Logging cookies in Tomcat 7
Posted by Konstantin Kolinko <kn...@gmail.com>.
2012/11/26 Russ Kepler <ru...@kepler-eng.com>:
> On Monday, November 26, 2012 01:44:25 PM Christopher Schultz wrote:
>
> so if there doesn't seem to be a general "print the cookies" pattern. I see a %S and that seems to be printing
You can print all cookies sent by the client with %{Cookie}i
and new cookies sent by server with %{Set-Cookie}o
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Logging cookies in Tomcat 7
Posted by Russ Kepler <ru...@kepler-eng.com>.
On Monday, November 26, 2012 01:44:25 PM Christopher Schultz wrote:
> On 11/26/12 1:27 PM, Russ Kepler wrote:
> > I'm running Tomcat 7 with juli logging enabled and so I'm seeing
> > the standard logfiles. In my access log I'm seeing the standard
> > entries on each line and I'd like to see the cookies being passed
> > as well - is there an easy way to do this - a property to set on
> > the start up or something similar?
>
> Do you need to be able to see arbitrary cookies, or do you have a
> specific list of cookies for which you'd like to see values?
I'm trying to see if I'm passing the right jsessionid from a Java Web Start
application. I've found the AccessLogValve entry in the server.xml and added
"%{jsessionid}c" to the log pattern. I'm not seeing anything added to the log
output, adding some plaintext to the pattern showed that I was in the right
neighborhood. I tried "%c" and got ???c???, so if there doesn't seem to be a
general "print the cookies" pattern. I see a %S and that seems to be printing
the session id but the session id seems to be changing between accesses:
127.0.0.1 - webtyper [26/Nov/2012:11:56:29 -0700] "GET /WebTyper/Hello.jsp
HTTP/1.1" 0B9EA01DEAD73DB885183DEC535251B7 200 470
127.0.0.1 - webtyper [26/Nov/2012:11:56:30 -0700] "GET /WebTyper/appload.jsp
HTTP/1.1" 0B9EA01DEAD73DB885183DEC535251B7 200 814
127.0.0.1 - - [26/Nov/2012:11:56:31 -0700] "GET /WebTyper/app/Webtyper.jar
HTTP/1.1" 61592CE719254921F8D1543FBE44A4FF 304 -
127.0.0.1 - - [26/Nov/2012:11:56:43 -0700] "POST
/WebTyper/data/json/typer/post HTTP/1.1" 61592CE719254921F8D1543FBE44A4FF 403
1195
(sorry for the split lines)
So between the Java Web Start accessing the .jnlp and .jar the session id
changes, and I thought I was setting it properly on the client end. The
servlet is being dispatched through HttpServletDispatcher but I thought the
session id would be common. Am I mistaken or just screwed up in my thoughts?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Logging cookies in Tomcat 7
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Russ,
On 11/26/12 1:27 PM, Russ Kepler wrote:
> I'm running Tomcat 7 with juli logging enabled and so I'm seeing
> the standard logfiles. In my access log I'm seeing the standard
> entries on each line and I'd like to see the cookies being passed
> as well - is there an easy way to do this - a property to set on
> the start up or something similar?
Do you need to be able to see arbitrary cookies, or do you have a
specific list of cookies for which you'd like to see values?
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with undefined - http://www.enigmail.net/
iEYEARECAAYFAlCzuIkACgkQ9CaO5/Lv0PCAegCgsw4KgaWKluqIVgvV0NO/1Azc
L0QAoJj6PmlG2RVhiM8i+6tgYyYJPzgy
=3C3D
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org