Hi. I'm trying to hack vhost-specific access.log (.../vhost/canonicalhostnamehere.log) support into nevow, and while doing that, ran into web2's logging features -- I don't want to do things totally differently from web2. What I did with nevow was add ILogger, which is looked up from the context and is responsible for writing the access.log entry for the current request. Thus, vhosts can just remember an ILogger to implement different access log destinations. What web2 seems to be heading at is using log.msg and a interface=IRequest to do access.logging. How do you see my vhost logging functionality should be done with web2? Adding observers doesn't really help, AFAICS the best you could do that way is log the request in both the default access.log and the vhost log file. Also, web2 really should pass the context to log.msg(). Also, how do you feel the date and time generation and parsing in t.w.http should be done? I need to be able to generate access.log entries, and current t.w.http really isn't librarified enough. I'm thinking of extracting that functionality in a more library-like manner into nevow.timestamp and nevow.log, which could at the same time become t.web2.{timestamp,log}.
Tommi Virtanen wrote:
Hi. I'm trying to hack vhost-specific access.log (.../vhost/canonicalhostnamehere.log) support into nevow, and while doing that, ran into web2's logging features -- I don't want to do things totally differently from web2.
This is all pretty much done, in branches/tv/log.
Also, how do you feel the date and time generation and parsing in t.w.http should be done? I need to be able to generate
This is still ugly. Currently, a log of the things have an explicit .close() you need to call, or they leave a timer running (also making trial complain). Current starting the timer (incrementing the reference count) is implicit in object creation; I'm currently thinking of making it be an explicit operation. That would make it an unnecessary detail for any code that runs while a NevowSite factory is running, only leaving the start/stop in things that use timestamp/log outside of a real webserver -- mostly unit tests, that is.
On Apr 15, 2005, at 4:51 AM, Tommi Virtanen wrote:
Also, how do you feel the date and time generation and parsing in t.w.http should be done? I need to be able to generate
This is still ugly. Currently, a log of the things have an explicit .close() you need to call, or they leave a timer running (also making trial complain).
Current starting the timer (incrementing the reference count) is implicit in object creation; I'm currently thinking of making it be an explicit operation. That would make it an unnecessary detail for any code that runs while a NevowSite factory is running, only leaving the start/stop in things that use timestamp/log outside of a real webserver -- mostly unit tests, that is.
I'd note that there are a bunch of other places where twisted.web[2] use the current time, so, it's probably not particularly worth it to put in a special hack to not call time.time in log, while doing nothing about all the other uses of time.time. You could use the response Date header as the log time, if you like. James
participants (2)
-
James Y Knight
-
Tommi Virtanen