[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index] [Home]

capture stdout and stderr with apache/jserv!


hi all,

So many people have asked how to capture stdout and stderr and I've
finally found an easy way with jserv.  It works with all servlets
and jsp pages (doesn't matter what gnujsp you use).

Basically, there's a package called jconsole.zip which captures
stdout/stderr to a window and/or log file.

When started as a NT service, you can't see the window, but a log file
is appended to in your ../jserv/logs directory which you can tail, just 
like
any other log file!

Here are 10 easy steps to do it (assuming apache is in c:\apps\apache and
jserv is in c:\apps\jserv):

1. download jconsole.zip from www.si4java.com (I have no affiliation with 
them).
2. unzip and make sure the following exists, 
c:\apps\jconsole\lib\jconsole.zip
3. cd c:\apps\jconsole\examples
4. test jconsole, jre -cp .;..\lib\jconsole.zip Example1

ok, so jconsole is working, you see it capturing in a window,
but now, we'll configure jserv to use jconsole, and get jconsole to
log into c:\apps\jserv\logs\jconsole.log

5. you need to modify jserv.java (see my modified 1.0b5)
	ftp://www.rcreations.com/pub/jserv.java
6. compile it, or use my ApacheJServ.jar
	ftp://www.rcreations.com/pub/ApacheJServ.jar
7.modify jserv.properties to include jconsole by adding this line:
	wrapper.classpath=c:\apps\jconsole\lib\jconsole.zip
8. modify jserv.properties to enable jconsole (dev server only) by 
appending these lines at end of file:
	#JConsole
	jconsole=true
	jconsole.conf=C:\apps\JServ\conf\jconsole.conf
9. copy the following jconsole.conf file into c:\apps\jserv\conf (this 
config file specifies things like log filepath).
	ftp://www.rcreations.com/pub/jconsole.conf
10. thats it!  run apache.exe and you'll see a log window, along with the 
log file.  run "net start apache" and you'll get just the log (fine by me, 
it do "tail -f c:\apps\jserv\logs\jconsole.log").

enjoy,
rob