On Mon, 2002-10-28 at 09:33, Michael Montagne wrote:
> I'm trying to get a good debugging environment.  It seems that the docs
> say the print statements go to stdout so that seems like a good place to
> start.  I use this script to start the appserver but print statements do
> not go to the $LOG file like I would hope.  Is this hoe it can work or
> do I need to start the appserver from the command line to get them to
> appear there?

Your script looks ok, just from looking at it.  I wouldn't recommend
running webware as root, though.

As for the print statements not showing up in your logfile, I've added
a sys.stdout.flush() call in ThreadedAppServer so that everything is
written to my logfile after each request (otherwise the output will be
buffered, and doesn't appear until you've done 5-10 requests).

So open up ThreadedAppServer.py, search for "duration" (where webware
prints the elapsed time for the request), and add the line at the bottom
so it looks like:

        if verbose:
            duration = '%0.2f secs' % (time.time() - startTime)
            duration = string.ljust(duration, 19)
            print '%5i  %s  %s' % (self._number, duration, requestURI)
            print
            sys.stdout.flush()

This should probably be made into a configurable option in the
AppServer.config (the flush will affect performance, but is very useful
for debugging).


> 
> 
> #!/bin/sh
> #
> # Startup script for WebKit on UNIX systems.
> #
> # See Webware/WebKit/Docs/InstallGuide.html for instructions.
> 
> # chkconfig: 2345 75 25
> # description: WebKit is a Python application server, part of Webware.
> 
> 
> # Configuration section
> #WEBKIT_DIR=/usr/local/src/Webware-0.7/WebKit
> WEBKIT_DIR=/home/michael/Webware
> 
> #WEBKIT_DIR=/opt/Webware/WebKit
> PID_FILE=/var/run/webkit.pid
> LOG=/var/log/webkit
> PYTHONPATH=
> 
> # end configuration section
> 
> 
> # Source function library.
> # Use the funtions provided by Red Hat or use our own
> if [ -f /etc/rc.d/init.d/functions ]
> then
>       . /etc/rc.d/init.d/functions
> else
>       function action {
>               echo "$1"
>               shift
>               $@
>       }
>       function success {
>               echo -n "Success"
>       }
>       function failure {
>               echo -n "Failed"
>       }
> fi
> 
> 
> [ -x $WEBKIT_DIR/AppServer ] || exit 0
> 
> case "$1" in
>       start)
>               echo -n  "Starting WebKit: "
>               pushd $WEBKIT_DIR > /dev/null
>               LAUNCH='python Launch.py ThreadedAppServer'
> 
>               # log separator
>               echo 
>"----------------------------------------------------------------------" >> $LOG
> 
>               # run as root:
>               $LAUNCH >> $LOG 2>&1 &
> 
>               # run as a user named 'webware':
>               #su -c "$LAUNCH" webware >> $LOG 2>&1 &
> 
>               echo $! > $PID_FILE
>               popd > /dev/null
>               success "Starting WebKit"
>               echo
>               ;;
> 
>       stop)
>               echo -n "Shutting down WebKit: "
>               if test -f "$PID_FILE" ; then
>                       PID=`cat $PID_FILE`
>                       if kill $PID >> $LOG 2>&1 ; then
>                               /bin/rm $PID_FILE
>                               success "Shutting down WebKit"
>                       else
>                               echo ""
>                               echo "Could not kill process $PID named in $PID_FILE. 
>Check tail of $LOG."
>                               failure "Shutting down WebKit"
>                       fi
>               else
>                       echo ""
>                       echo "No WebKit pid file found. Looked for $PID_FILE."
>                       failure "No WebKit pid file found. Looked for $PID_FILE."
>               fi
>               echo
>               ;;
> 
>       restart)
>               $0 stop
>               $0 start
>               ;;
> 
>       *)
>               echo "Usage: webkit {start|stop|restart}"
>               exit 1
> 
> esac
> 
> exit 0
> 
> 
> 
> 
> 
> -- 
> Michael Montagne
> [EMAIL PROTECTED]
> http://www.themontagnes.com
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
-- 
Jason D. Hildebrand
[EMAIL PROTECTED]



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to