Please browse the categories below to previous answers to questions like yours. If you do not find the answer for your particular situation, ask for help on the appropriate mailing list.
(Answer) (Category) Java Apache Project : (Category) Apache JServ 1.0 : (Category) Configuration :
Where does System.out.print() go? or Logging from a servlet...
----------
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
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.
----------
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
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 manual mode. Do this as follows (running Apache 1.3.6 at \apache\ and ApacheJServ1.0 at \apache\jserv):
  1. read Ari's excellent article: http://www.magiccookie.com/computers/apache-jserv/. Search for 'Running Apache JServ'.
  2. change the ApJServManual directive from off to on. This is located in the \apache\jserv\mod_jserv.conf file.
  3. invoke JServ 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.

    contents of \apache\jserv\jserv.cmd:
    \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

  4. 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).
Buena suerte, Paul
> 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
[Append to This Answer]
Previous: (Answer) Session Management and Multiple Domains
Next: (Answer) Running Apache JServ on RedHat Linux, it gives me errors saying it can't find the JServ class
This document is: http://java.apache.org/faq/?file=39
[Search] [Appearance] [Show Expert Edit Commands]
This is a Faq-O-Matic 2.709.
Please browse the categories below to previous answers to questions like yours. If you do not find the answer for your particular situation, ask for help on the appropriate mailing list.