From: boating12345
Subject: Logging with Allegroserve
Date: 
Message-ID: <1162475566.188206.67850@i42g2000cwa.googlegroups.com>
Dear All,

As you may or may not know we have this LEWIS application server and
its built with SBCL on top of allgroserve. Does anyone know how to
create LOG records from allegroserve. What I mean is that when someone
requests a dynamic or static page I can write their request to a LOG
for stats purposes.

I've got some basic logging but there appears not to be a simple way of
getting the information displayed on the screen when a user requests a
page?!?

Paul
http://www.hyperstring.net

From: Wade Humeniuk
Subject: Re: Logging with Allegroserve
Date: 
Message-ID: <w_m2h.36764$P7.9624@edtnps90>
boating12345 wrote:
> Dear All,
> 
> As you may or may not know we have this LEWIS application server and
> its built with SBCL on top of allgroserve. Does anyone know how to
> create LOG records from allegroserve. What I mean is that when someone
> requests a dynamic or static page I can write their request to a LOG
> for stats purposes.
> 

There is a hook arg on the net.aserve:publishxxxxx functions.  I assume you
can use that to add a hook that logs the request.

Wade
From: =?ISO-8859-15?Q?Andr=E9_Thieme?=
Subject: Re: Logging with Allegroserve
Date: 
Message-ID: <eid6hg$h2k$1@registered.motzarella.org>
boating12345 schrieb:
> Dear All,
> 
> As you may or may not know we have this LEWIS application server and
> its built with SBCL on top of allgroserve. Does anyone know how to
> create LOG records from allegroserve. What I mean is that when someone
> requests a dynamic or static page I can write their request to a LOG
> for stats purposes.
> 
> I've got some basic logging but there appears not to be a simple way of
> getting the information displayed on the screen when a user requests a
> page?!?

When an object is requested from AllegroServe then the method
net.aserve::log-request is called. You can simply replace it with your
own version.
The stream to which you want to log can be changed via
(vhost-log-stream (wserver-default-vhost *wserver*)


Andr�
-- 
From: boating12345
Subject: Re: Logging with Allegroserve
Date: 
Message-ID: <1162534348.669703.75210@f16g2000cwb.googlegroups.com>
André Thieme wrote:
> boating12345 schrieb:
> > Dear All,
> >
> > As you may or may not know we have this LEWIS application server and
> > its built with SBCL on top of allgroserve. Does anyone know how to
> > create LOG records from allegroserve. What I mean is that when someone
> > requests a dynamic or static page I can write their request to a LOG
> > for stats purposes.
> >
> > I've got some basic logging but there appears not to be a simple way of
> > getting the information displayed on the screen when a user requests a
> > page?!?
>
> When an object is requested from AllegroServe then the method
> net.aserve::log-request is called. You can simply replace it with your
> own version.
> The stream to which you want to log can be changed via
> (vhost-log-stream (wserver-default-vhost *wserver*)
>
>
> André
> --

HI André

Ok I'm testing this will let everyone know how I get on!

Paul
From: boating12345
Subject: Re: Logging with Allegroserve
Date: 
Message-ID: <1162536066.088436.142510@h48g2000cwc.googlegroups.com>
HI Again

OK as an experiment I did this

(defvar *log-stream* nil)

(defun start-servers ()

    (start: etc)
    (setf *log-stream* (open "/home/paulc/weblog.log" :direction
:output :if-exists :append))
    (setf (vhost-log-stream (wserver-default-vhost *wserver*)
*log-stream*)

Other stuff...


)

Now - if you check

(vhost-log-stream (wserver-default-vhost *wserver*))

It says

#<SB-SYS:FD-STREAM for "file /home/paulc/weblog.log" {AF12D21} >

However upon accessing the web server nothing seems to be written to
that file!

Paul
http://www.hyperstring.net
From: boating12345
Subject: Re: Logging with Allegroserve
Date: 
Message-ID: <1162539136.324294.265690@k70g2000cwa.googlegroups.com>
Sadly I am replying to my own messages!

Anyway - The answer I found at this web page

http://cl-debian.alioth.debian.org/repository/pvaneynd/cl-portable-aserve/aserve/log.cl

It shows how the logging works so since the pages that are requested
are computed thats not a problem.

I constructed the log code by doing things like

    (write-to-log this-server (concatenate 'string
					   (header-slot-value request :user-agent)
					   ","
					   (header-slot-value request :referer)
					   ","
					   (header-slot-value request :location)
					   ","
					   (header-slot-value request :date)
					   ","
					   (header-slot-value request :from))
     				   (acl-compat.socket:ipaddr-to-dotted
(acl-compat.socket:remote-host (request-socket request)))

Note the last bit - thats the remote users IP address.

What I'm going to do as well when it's done is to provide a way to
export the logs to IIS format or something a standard stats package can
read, at the moment they are getting loaded to MYSQL server.

Paul
http://www.hyperstring.net
From: =?ISO-8859-15?Q?Andr=E9_Thieme?=
Subject: Re: Logging with Allegroserve
Date: 
Message-ID: <eifmf0$1oh$1@registered.motzarella.org>
boating12345 schrieb:
> Sadly I am replying to my own messages!

Hello?? I won't stop sleeping to answer earlier...


> Anyway - The answer I found at this web page
> 
> http://cl-debian.alioth.debian.org/repository/pvaneynd/cl-portable-aserve/aserve/log.cl
> 
> It shows how the logging works so since the pages that are requested
> are computed thats not a problem.

I told you that you can replace net.aserve::log-request.
There you could also put in some code to write into a sql db for example.



> I constructed the log code by doing things like
> 
>     (write-to-log this-server (concatenate 'string
> 					   (header-slot-value request :user-agent)
> 					   ","
> 					   (header-slot-value request :referer)
> 					   ","
> 					   (header-slot-value request :location)
> 					   ","
> 					   (header-slot-value request :date)
> 					   ","
> 					   (header-slot-value request :from))
>      				   (acl-compat.socket:ipaddr-to-dotted
> (acl-compat.socket:remote-host (request-socket request)))
> 
> Note the last bit - thats the remote users IP address.
> 
> What I'm going to do as well when it's done is to provide a way to
> export the logs to IIS format or something a standard stats package can
> read, at the moment they are getting loaded to MYSQL server.


Andr�
-- 
From: boating12345
Subject: Re: Logging with Allegroserve
Date: 
Message-ID: <1162579718.219453.95460@f16g2000cwb.googlegroups.com>
Hi  André

That's cool will do after the weekend thanks for your help!

Paul
http://www.hyperstring.net
From: =?ISO-8859-15?Q?Andr=E9_Thieme?=
Subject: Re: Logging with Allegroserve
Date: 
Message-ID: <eifm6b$1im$1@registered.motzarella.org>
boating12345 schrieb:
> OK as an experiment I did this
> 
> (defvar *log-stream* nil)
> 
> (defun start-servers ()
> 
>     (start: etc)
>     (setf *log-stream* (open "/home/paulc/weblog.log" :direction
> :output :if-exists :append))
>     (setf (vhost-log-stream (wserver-default-vhost *wserver*)
> *log-stream*)
> 
> 
> Now - if you check
> 
> (vhost-log-stream (wserver-default-vhost *wserver*))
> 
> It says
> 
> #<SB-SYS:FD-STREAM for "file /home/paulc/weblog.log" {AF12D21} >
> 
> However upon accessing the web server nothing seems to be written to
> that file!


(defvar *log-stream*)
(defvar *original-vhost-log-stream*)

(setf *original-vhost-log-stream*
       (vhost-log-stream (wserver-default-vhost *wserver*))

       *log-stream*
       (open "server.log"
             :direction :output
             :if-does-not-exist :create
             :if-exists :append)

       (vhost-log-stream (wserver-default-vhost *wserver*))
       *log-stream*)

works for me.


Andr�
-- 
From: Petter Gustad
Subject: Re: Logging with Allegroserve
Date: 
Message-ID: <7d4ptcdfpq.fsf@www.gratismegler.no>
"boating12345" <············@hyperstring.net> writes:

> I've got some basic logging but there appears not to be a simple way of
> getting the information displayed on the screen when a user requests a
> page?!?

You can also provide your own version of logmess to write to a file or
insert a record in a database or just throw away the output:

http://groups.google.com/group/comp.lang.lisp/msg/ca3888e88946d454?dmode=source&hl=en

Petter

-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?