[Seaside] Web Hit logging with Seaside
Nevin Pratt
nevin at smalltalkpro.com
Sat Apr 19 13:03:33 CEST 2003
Derek Brans wrote:
>Why not just keep a count on the class side of the WAComponent subclass that
>gets incremented every time renderContentOn is called?
>
>
>
Logging is typically a bit more sophisticated than that. There are
typically a few more things that a good web log will give you. Among
them are:
1. the IP of the web visitor, and optionally a domain name (resolved
from the IP).
2. the date/time of the visit.
3. the browser they were using.
4. the domain name they are visiting.
The date/time of the visit is obviously easy. The browser info is in
(if I remember correctly) the header of the Comanche HttpRequest
instance. The visitor's IP is also in the HttpRequest instance.
#4 (the domain name being visited) sounds obvious-- after all, if they
reached your machine, it must be your domain name they are visiting,
right? Well, not to mention the fact that your machine might be doing
virtual hosting (like mine does), in real life various software often
either deliberately or unintentionally munges this info in the request
header, and if the domain name in the request header doesn't match your
machine, then potentially the sender is trying to spoof something. So,
it's still useful to look at, and log such descrepancies. And if you
are doing virtual hosting, it is often pretty much mandatory to log the
domain name being accessed. And if there is money involved-- i.e.,
charging and/or crediting money based on domain access-- and you are
doing virtual hosting, it *is* mandatory.
Anyway, all of this info to be logged is either calculatable, or it is
in the HttpRequest instance. But, there doesn't seem to be any way to
access the Comanche HttpRequest instance from within the Seaside
framework, so without some framework mods there doesn't seem to be any
way to do this from within Seaside (a minor mod to add the Comanche
HttpRequest instance to the WARequest and/or the WAApplication that is
built in WAKom>>process: would probably do it).
And if you were so inclined, another thing to consider is the question
of how Apache does it's logs. If the Seaside logging followed the same
format, there is a whole raft of existing tools that could be used to
analyze the logs.
But, without framework mods, the current Seaside framework doesn't seem
to readily support web hit logging (unless I'm missing something
somewhere). And, any current Comanche logging framework is pretty much
worthless with Seaside, because it will log some weird looking URL
instead of the Seaside component being accessed.
Nevin
More information about the Seaside
mailing list