File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes monitor tomcat and how to view system.out.println on the server? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "monitor tomcat and how to view system.out.println on the server?" Watch "monitor tomcat and how to view system.out.println on the server?" New topic
Author

monitor tomcat and how to view system.out.println on the server?

Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
Hi all,

I have a Linux server with Tomcat running for a struts application. Some users log in, manipulate their data...etc.

1. I wonder if there's any application that can show some statistics about the application in terms of -who's logged in, for how long, what tomcat is handling...etc.

2. in my application I have some system.out.println... (i do this because it shows me what am I clicking). Question is -how can I view them on the server? (In my development I see it on the eclipse's console)

thanks for any pointer.
[ August 23, 2007: Message edited by: Peter Primrose ]
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Peter Primrose:
Hi all,

I have a Linux server with Tomcat running for a struts application. Some users log in, manipulate their data...etc.

1. I wonder if there's any application that can show some statistics about the application in terms of -who's logged in, for how long, what tomcat is handling...etc.


This is not hard to write and is a great exercise for learning the servlet spec. I have an example app on my site that does just this:
http://simple.souther.us/not-so-simple.html
Look for SessionMonitor.



2. in my application I have some system.out.println... (i do this because it shows me what am I clicking). Question is -how can I view them on the server? (In my development I see it on the eclipse's console)


The unix 'tail' program with the -f (f is for follow) switch will keep updating the console as the file it's watching is updated.



will watch every log in the TOMCAT-INSTALL/logs directory and dump contents to the console as they are added.
[ August 22, 2007: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Tip:
Questions generally stand a better chance of getting answered and already answered questions stand a better chance of being helpful to others if there is a good subject line and if the keywords in the subject line are spelled correctly.
It would be helpful if you could change the spelling of 'mintor' to 'monitor', if that's what you really mean.
You can change it by clicking the link in the top post of this thread.
steve souza
Ranch Hand

Joined: Jun 26, 2002
Posts: 861
www.javaperformancetuning.com should have a list of tools that can help.

The open source JAMon mentioned in my links below can help too.

1. I wonder if there's any application that can show some statistics about the application in terms of -who's logged in, for how long, what tomcat is handling...etc.

JAMon comes with a servlet filter in the current release that tracks page performance and whether pages are currently executing. You can also add jamon listeners via the jamon admin page to keep track of details of your slower pages.

The next release of jamon will come with a TomCat valve that will allow you to monitor anything within the Request and Response object (such as http status code, content length and more). This will be in jamon-2.7. I estimate that it will be released in 2 weeks. All this requires no code.

<<2. in my application I have some system.out.println... (i do this because it shows me what am I clicking). Question is -how can I view them on the server? (In my development I see it on the eclipse's console) >>

Jamon comes with a log4j appender that allows you to 'tail' and query the log via a jamon web page.

note jamon also comes with a jdbc proxy driver that allows you to view query performance.

See the demo below for an example of jamon running in tomcat.
[ August 22, 2007: Message edited by: steve souza ]

http://www.jamonapi.com/ - a fast, free open source performance tuning api.
JavaRanch Performance FAQ
Peter Primrose
Ranch Hand

Joined: Sep 10, 2004
Posts: 755
thanks!
got some new ideas :-) will try and return with my impression
 
Don't get me started about those stupid light bulbs.
 
subject: monitor tomcat and how to view system.out.println on the server?