aspose file tools*
The moose likes Tomcat and the fly likes Printing the Url's in a jsp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Printing the Url Watch "Printing the Url New topic
Author

Printing the Url's in a jsp

Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9521
    
    2

Hi Guys,

Is there a way to print the url hitting Tomcat. Are there any configuraton changes that I can set up in Tomcat so that I can do this??
[ March 25, 2007: Message edited by: Jothi Shankar Kumar Sankararaj ]

SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Print them to where; the user's browser, a log file on the server?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Joe Harry
Ranch Hand

Joined: Sep 26, 2006
Posts: 9521
    
    2

Print them to the Tomcat console!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42635
    
  65
If you are talking of the local URL that is being accessed, then that is being logged on the access log in the TOMCAT_HOME/logs file.

If you are talking of the REFERER header, then you could write a filter that is mapped to all requests which reads that from the request and logs it to System.out. That would also work for logging the local URL.


Ping & DNS - my free Android networking tools app
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

In tomcat/conf/server.xml there is an entry for a access-logging valve.
It is commented out by default.
If you uncomment it, it will log all access to tomcat in the standard logging format, recognized by Webalizer and the other popular log analyzing tools.

Depending on how you've installed and started Tomcat, stdout will either go to one of the log files under tomcat/logs or to the console.
There are free programs out there that will allow you to watch any log, in real time, just like the console.

In Unix the "tail -f" command will do this.
I've seen various free "tail" programs for windows.
Textpad also allows you to do this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Printing the Url's in a jsp