IDependOn-Set: 1
IDependOn-Set: 2
IDependOn-Set: 35
IDependOn-Set: 39
IDependOn-Set: 40
IDependOn-Set: 7
LastModifiedSecs: 935437399
Parent: 7
SequenceNumber: 15
Title: Where does System.out.print() go? or Logging from a servlet...
Part: 0
Author-Set: jon@working-dogs.com
HideAttributions: 1
LastModifiedSecs: 921004440
Type: monospaced
Lines: 32
----------
From: Paul Shannon <pshannon@u.washington.edu>
To: java-apache-users@list.working-dogs.com
Subject: Re: An old problem am sure . . . . System.out
Date: Tue, Mar 9, 1999, 7:47 AM

    "due to the fact System.out.println(...) is dead."

For my installation, System.out and System.err are under the
control  of /bin/java.  So I start ApJ manually out of a bash
shell script (I don't know redirection tricks in the bourne shell...)
like this:

  #!/usr/local/bin/bash

  # set up the CLASSPATH and LD_LIBRARY_PATH....

  PROPS=/opt/jserv10b3/conf/jserv.properties
  LOG=/opt/jserv10b3/logs/jserv.log

  java -classpath $CLASSPATH org.apache.jserv.JServ $PROPS > $LOG 2>&1  &

     > $LOG says "write stdout to here"

and
  
    2>&1  says  "write stderr to the same place as stdout"

With this, both stdout and stderr go to the standard jserv log.
(I don't know how to find the results of log (), however.)

 - Paul
EndPart: 0
Part: 1
Author-Set: jon@working-dogs.com
HideAttributions: 1
LastModifiedSecs: 921025140
Type: monospaced
Lines: 5
System.out.println() goes to the console that started up the JVM. 
So, if the httpd process starts the JVM (ie: Apache JServ in automatic mode), 
then the System.out goes to the console of the user that started the httpd 
(ie: root). If you start the JVM (and Apache JServ process on the command 
line, then it goes to that user who started the JVM process.
EndPart: 1
Part: 2
Author-Set: jon@working-dogs.com
HideAttributions: 1
LastModifiedSecs: 923509980
Type: monospaced
Lines: 20
----------
From: Pierpaolo Fumagalli <p_fumagalli@fumagalli.org>
To: Java Apache Users <java-apache-users@list.working-dogs.com>
Subject: Re: Repost : where is the Standard output file???
Date: Wed, Apr 7, 1999, 10:58 AM


Sven Duzont wrote:
> 
> Does anybody know how to access the Standard Output console on windows NT
> using Apache Jserv ???
> I have already posted this question last week but i found no answer!!!
> Thanks in advance.
> 
There's no way to access to the console while JServ or Apache is running
as a service.
You can start it manually from the MS-Dos prompt, and then the console
ends up in the MS-Dos prompt window....

        Pier
EndPart: 2
Part: 3
Author-Set: johnston.p@worldnet.att.net
HideAttributions: 1
LastModifiedSecs: 934157038
Type: html
Lines: 18
I was having trouble finding System.out on an NT box.  Essentially, the problem for me I didn't realize that JServ has to be started in
<I>manual</I> mode.  Do this as follows (running Apache 1.3.6 at \apache\ and ApacheJServ1.0 at \apache\jserv):
<OL>
<LI>read Ari's excellent article: <A HREF="http://www.magiccookie.com/computers/apache-jserv/">http://www.magiccookie.com/computers/apache-jserv/</A>.  Search for 'Running Apache JServ'.
<LI>change the <B>ApJServManual</B> directive from <I>off</I> to <I>on</I>.  This is located in the <B>\apache\jserv\mod_jserv.conf</B> file.
<LI>invoke <B>JServ</B> as you would any other java program.  I made a cmd script to simplify this called 'jserv.cmd', which I placed under \apache\jserv for easy reference.
As you can see fom the following, the 1.2 interpreter is invoked with an explicit classpath to rt.jar and the ApacheJServ.jar.  The class Jserv is executed with the jserv.properties file as the sole argument.
<P>
<CODE>
contents of <B>\apache\jserv\jserv.cmd</B>:<BR>
\java\jdk1.2\bin\java -classpath /java/jdk1.2/jre/lib/rt.jar;/apache/jserv/ApacheJServ.jar org.apache.jserv.JServ \apache\jserv\conf\jserv.properties
</CODE>
<P>
<LI>At this point you're ready to rumble.  Remember, you have to start both the Apache webserver and jserv now (thus the 'manual').
Open a shell, execute the \apache\jserv\jserv.cmd (you can typically leave the .cmd off), and you should be set (at least I was).
</OL>
Buena suerte,
Paul
EndPart: 3
Part: 4
Author-Set: jon@working-dogs.com
HideAttributions: 1
LastModifiedSecs: 935437354
Type: monospaced
Lines: 28
> Whilst developing servlets my development 
          > team often put System.err.println() statements in the servlet code. 
          > Unfortunately, these error strings always get printed to main apache
          > error log and not the virtual host or servlet zone's error log. Has anyone
          > encountered this problem before and found a solution to isolate the errorlog output. 

          have them use 

          log("error string); 

          or
          getServletContext.log(e, "an error ");


          or
          use the following and write the error stack trace back to the browser or to the log.

                  /* PrintStackTraceAsString from com.oreilly.servletServletUtils from 
                          Java Servlet Programming, by Jason Hunter and William Crawford, O'Reilly, 1998 
                  */
                  public String getStackTraceAsString(Exception e){
                          ByteArrayOutputStream bytes = new ByteArrayOutputStream();
                          PrintWriter writer = new PrintWriter(bytes, true);
                          e.printStackTrace(writer);
                          return bytes.toString();
                  }

          brettATknightsofthenetDOTcom
EndPart: 4
