[Zope-PAS] Re: [Plone-developers] Getting PAS users to show up in the access log/Z2.log

Ross Patterson me at rpatterson.net
Thu Aug 23 19:35:00 EDT 2007


Wichert Akkerman <wichert at wiggy.net> writes:

> Previously Ross Patterson wrote:
>> Wichert Akkerman <wichert at wiggy.net>
>> writes:
>> 
>> > Previously Ross Patterson wrote:
>> >> Ross Patterson <me at rpatterson.net> writes:
>> >> 
>> >> > It seems like ZServer/medusa/http_server.py is responsible for logging
>> >> > requests to the access log/Z2.log and it only extracts the user from the
>> >> > HTTP basic auth header.
>> >> >
>> >> > I'd like to have the Z2.log reflect my PAS users so I started a branch at
>> >> > http://svn.zope.org/PluggableAuthService/branches/rossp-access-log/ that
>> >> > hacks some request data.  You can see the meat of it in the following
>> >> > changeset:
>> >> >
>> >> > http://svn.zope.org/PluggableAuthService/branches/rossp-access-log/PluggableAuthService.py?view=diff&r1=79171&r2=79170> >
>> >> > I'm sure this is just about the worst way to do this.  :)  I just wanted
>> >> > to get the discussion started.
>> >> >
>> >> > I suspect that ZServer/medusa/http_server.py is only invoved for certain
>> >> > Zope setups and that other Zope setups (twisted, etc.?) might log
>> >> > differently.
>> >> >
>> >> > So what would be a better way to approach this?  Does anyone else have a
>> >> > solution to this problem?
>> >> 
>> >> I forgot to mention that one of my goals is to have this behavior be PAS
>> >> pluggable.  In particular, it seems obvious that user.getUserName()
>> >> should be the default that's used, but I have a need to use something
>> >> else, so I'd like to be able to write a plugin that does this.
>> >
>> > I suspect that instead of doing yet another PAS plugin it would be more
>> > useful to make the zserver logging modular.
>> 
>> I don't suppose you could provide any suggestions for a direction for
>> this?  I really know very little about the zserver.
>
> Perhaps it would be interesting to see if the standard python logging
> module can be used to log requests as well.

Yeah, I was thinking about that.  If it were so, then at least I'd have
one way to modify the behavior more modularly.

One thing I can't quite think my way out of is that the logging is done
in the response._finish() in
ZServer/PubCore/ZServerPublisher.py::27(__init__).  The problem is this
happens well after a bunch of other tear down has already completed,
such as resetting the SecurityManager.

Ross



More information about the Zope-PAS mailing list