From: Marco simon
Subject: How to see runtime-output of lisp-process ?
Date: 
Message-ID: <43031dfe$0$24151$9b4e6d93@newsread4.arcor-online.net>
Hello list,

I'm quite new to lisp an I've still some problems
with the lisp-handling.
My current Problem:
  I've got a little application, based on ucw which
  sends the final output (triggered by http-requests)
  to the browser (parsed to html-code).

  For testing and debugging-purpose I'd like to set some
  "show me your current value" outputs in the lisp-code
  which give me information about the variables' values.
  (somethin like (print *myvalue*) )

  Now my Problem: I write my code in emacs, send it to
  slime for compilation --> the slime-repl shows me some
  compilation info. After that point my code is productive
  and is executed as soon as I visite the Website which
  uses that code. But: I don't know where I can see the Output
  of (print *myvalue*) - the Repl doesn't tell me and I've no
  idea where else I should look for the output.

Thanks for some information in advance,
  best regard Marco

From: Pascal Bourguignon
Subject: Re: How to see runtime-output of lisp-process ?
Date: 
Message-ID: <874q9od63j.fsf@thalassa.informatimago.com>
Marco simon <···········@web.de> writes:
> I'm quite new to lisp an I've still some problems
> with the lisp-handling.
> My current Problem:
>   I've got a little application, based on ucw which
>   sends the final output (triggered by http-requests)
>   to the browser (parsed to html-code).
>
>   For testing and debugging-purpose I'd like to set some
>   "show me your current value" outputs in the lisp-code
>   which give me information about the variables' values.
>   (somethin like (print *myvalue*) )
>
>   Now my Problem: I write my code in emacs, send it to
>   slime for compilation --> the slime-repl shows me some
>   compilation info. After that point my code is productive
>   and is executed as soon as I visite the Website which
>   uses that code. But: I don't know where I can see the Output
>   of (print *myvalue*) - the Repl doesn't tell me and I've no
>   idea where else I should look for the output.

This is not related to UCW, it's a pure slime problem.
The  stream between swank and slime is heavily buffered (probably in
slime, not in swank).

Even with a newline and a FINISH-OUTPUT (or CLEAN-OUTPUT):

; SLIME 2005-07-06
(loop for i from 0 to 10 do
      (when (= 5 i) (print :hello) (terpri) (finish-output)) (sleep 1))

won't display :HELLO before the end of the loop.


Alternatives:

- use inferior-lisp, it works nicely.

- open a logging/debugging stream on an xterm, or to somewhere else.
  For example in clisp with or without slime:
     (with-open-stream (*log* (EXT:MAKE-XTERM-IO-STREAM))
         (loop for i from 0 to 10 do
               (when (= 5 i) (print :hello *log*)) (sleep 1)))
  works perfectly.

- a standard way to do it would be:
    M-x shell RET touch /tmp/log ; tail -f /tmp/log RET
    and in slime:
    (with-open-file (*log* "/tmp/log" :direction :output :if-exists :append)
         (loop for i from 0 to 10 do
               (when (= 5 i) 
                  (print :hello *log*) (terpri *log*) (finish-output *log*))
               (sleep 1)))

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
The rule for today:
Touch my tail, I shred your hand.
New rule tomorrow.
From: Brian Downing
Subject: Re: How to see runtime-output of lisp-process ?
Date: 
Message-ID: <MRdNe.42783$084.8333@attbi_s22>
In article <··············@thalassa.informatimago.com>,
Pascal Bourguignon  <····@mouse-potato.com> wrote:
> This is not related to UCW, it's a pure slime problem.
> The  stream between swank and slime is heavily buffered (probably in
> slime, not in swank).
> 
> Even with a newline and a FINISH-OUTPUT (or CLEAN-OUTPUT):
> 
> ; SLIME 2005-07-06
> (loop for i from 0 to 10 do
>       (when (= 5 i) (print :hello) (terpri) (finish-output)) (sleep 1))
> 
> won't display :HELLO before the end of the loop.

Hmm... works for me with Slime and SBCL, OpenMCL, CMUCL, and Lispworks,
all on Mac OS X.

Perhaps it's a Slime/CLISP interaction problem?

-bcd
-- 
*** Brian Downing <bdowning at lavos dot net> 
From: Peter Seibel
Subject: Re: How to see runtime-output of lisp-process ?
Date: 
Message-ID: <m2vf24wkxz.fsf@gigamonkeys.com>
Marco simon <···········@web.de> writes:

> Hello list,
>
> I'm quite new to lisp an I've still some problems
> with the lisp-handling.
> My current Problem:
>   I've got a little application, based on ucw which
>   sends the final output (triggered by http-requests)
>   to the browser (parsed to html-code).
>
>   For testing and debugging-purpose I'd like to set some
>   "show me your current value" outputs in the lisp-code
>   which give me information about the variables' values.
>   (somethin like (print *myvalue*) )
>
>   Now my Problem: I write my code in emacs, send it to
>   slime for compilation --> the slime-repl shows me some
>   compilation info. After that point my code is productive
>   and is executed as soon as I visite the Website which
>   uses that code. But: I don't know where I can see the Output
>   of (print *myvalue*) - the Repl doesn't tell me and I've no
>   idea where else I should look for the output.
>
> Thanks for some information in advance,

Look in the *infererior-lisp* buffer. (The problem, I think, is that
SLIME can manage the streams for code that it executes. But other code
(such as code running in your web server) inherits the original
standard streams which are talking to the *inferior-lisp* buffer.)

-Peter

-- 
Peter Seibel           * ·····@gigamonkeys.com
Gigamonkeys Consulting * http://www.gigamonkeys.com/
Practical Common Lisp  * http://www.gigamonkeys.com/book/