• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to log the actual http request

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How can I log the actual http request (GET /servlet/snoop HTTP/1.0) for
each request handled by WebSphere (I need something similar to an http
access.log). Also if I have a page within a frame which has the meta "refresh" tag set to 60 seconds, will it show a long entry every minute?
Thanks
 
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(1) Build a logging filter and attach it to each of the servlets in your web.xml
(2) Yes. It would then show an entry every time the URL is invoked.
Kyle
 
Ranch Hand
Posts: 374
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kyle Brown:
(1) Build a logging filter and attach it to each of the servlets in your web.xml
(2) Yes. It would then show an entry every time the URL is invoked.
Kyle


(2)(a) ...Unless you code around it in your filter somehow, such as with a request parameter i.e. log=false which you could apply in the refresh tag. Beware, though, that if the user bookmarks the refreshed page, you have a problem in that the requests from the bookmark will not get logged.
 
GS Rollen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Kyle Brown:
(1) Build a logging filter and attach it to each of the servlets in your web.xml
(2) Yes. It would then show an entry every time the URL is invoked.
Kyle


Thanks for the suggestion, but as you can see, I'm just a greenhorn. Could you give me a little more detail on how to build this logging filter. For instance is this code I write in websphere? Then how would I attach this code once I had it? Oh and our environment is WAS 4.05.
One other question would be, is it is possible to get these requests to show up in the apache(IHS) access.log instead of a new custom log.
Thanks,
GS
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah... You should have told me you were still in WAS 4.0 earlier -- Filters are part of the Servlet 2.3 specification, and so will only work in WAS 5.0, not 4.0.
Doing this in 4.0 would be a much more challenging problem. I'm not even sure where to start in 4.0...
Kyle
 
GS Rollen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by GS Rollen:
How can I log the actual http request (GET /servlet/snoop HTTP/1.0) for
each request handled by WebSphere (I need something similar to an http
access.log). Also if I have a page within a frame which has the meta "refresh" tag set to 60 seconds, will it show a long entry every minute?
Thanks


Wow, I can't believe this issue has not really come up before. Our team likes to see how many times pages within a Websphere application get hit. We are thinking about just writing out to a custom log each time a page is loaded. We use System.Out.println() to log our errors etc. Would prefer a more elegant way, but we will simply try to mimic the apache logs. e.g.
220.148.122.210 - - [21/Nov/2003:14:37:32 -0500] "GET /mydir/index.html HTTP/1.1"
200 9402 "http://www.was.com/" "Mozilla/5.0 (Windows; U; Win 9x 4.9
0; en-US; rv:1.5) Gecko/20031007 Firebird/0.7"
I know we can do it, the question is might there be a better way? Also, is this way efficient enough for pages which display data every 60 seconds.
Thanks
GS
 
Kyle Brown
author
Posts: 3892
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, actually it has come up, which is why Filters were added to the Servlet 2.3 specification...
Now that I remember it, there were MIME-type filters available in WebSphere 4.0. You could do a search in the InfoCenter in 4.0 for "MIME Filter" and see if that helps.
Kyle
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic