Forums Register Login

servlet filters and logging

+Pie Number of slices to send: Send
Hello Gurus,
I am trying to log IP,date,URL when someone accesses my servlet using a Filter..
Everything works fine except that my servlet has multiple images and the log is getting filled with multiple entries, one entry for each image and html file served by the web container.
How can I avoid this to have only one entry per client request for servlet..
currently i am doing
context.log(date+getRequestURL()+getRemoteAddress())
My current log looks like
2002-12-10 04:50:39 -http://IP:8888/ra/Servlet1--< RemoteAddress>
2002-12-10 04:50:39 -http://IP:8888/ra/image1--< RemoteAddress>
2002-12-10 04:50:39 -http://IP:8888/ra/image2--< RemoteAddress>

I want to see only one entry for the Servlet1 and dont want to see the entries for image in the log...
Would appreciate any ideas..
thanks
Kiran
+Pie Number of slices to send: Send
If you could specify where the code for logging is invoked from, that will clarify the problem further.
Thanks.
+Pie Number of slices to send: Send
Hi
the filter is invoked for all components with <url-pattern> of /ra/* in web.xml
the <filter-name>,<filter-class>and <filter-mapping> are defined in the web.xml file...
This filter does pre-processing for any servlet accessed in the application
Pl let me know if u need more info to clarify
thanks
+Pie Number of slices to send: Send
Your log entries
2002-12-10 04:50:39 -http://IP:8888/ra/Servlet1--< RemoteAddress>
2002-12-10 04:50:39 -http://IP:8888/ra/image1--< RemoteAddress>
2002-12-10 04:50:39 -http://IP:8888/ra/image2--< RemoteAddress>
do fit the pattern specified for invocation of filter. Have you tried using commands like "someCommandName.someExtension" and map the servlet by "/ra/*.someExtension" instead of using hyperlinks directly ? That should solve your problem.
I am assuming that image1 and 2 are embedded somewhere in you page being served.
However I am not sure why image1 and image2 appear as seperate commands( you haven't listed them in hyperlink directly right ? )
+Pie Number of slices to send: Send
Let me try using the extension....
no, the images dont have hyperlink
thanks for ur suggestion Bhushan!
-Kiran
We should throw him a surprise party. It will cheer him up. We can use this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 1106 times.
Similar Threads
Calendar.roll() questions
question on servlet-mapping
HFJS ,chapter 12 -fatal error
Oracle 9i AS and struts!! Urgent
Logging ...
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 22:47:53.