[CalendarServer-changes] [4362] CalendarServer/trunk/twistedcaldav

source_changes at macosforge.org source_changes at macosforge.org
Fri Jun 19 16:24:27 PDT 2009


Revision: 4362
          http://trac.macosforge.org/projects/calendarserver/changeset/4362
Author:   cdaboo at apple.com
Date:     2009-06-19 16:24:17 -0700 (Fri, 19 Jun 2009)
Log Message:
-----------
Tweaks and fixes to new extended logging.

Modified Paths:
--------------
    CalendarServer/trunk/twistedcaldav/accesslog.py
    CalendarServer/trunk/twistedcaldav/extensions.py
    CalendarServer/trunk/twistedcaldav/method/propfind.py
    CalendarServer/trunk/twistedcaldav/method/report_calquery.py
    CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
    CalendarServer/trunk/twistedcaldav/scheduling/processing.py
    CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py

Modified: CalendarServer/trunk/twistedcaldav/accesslog.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/accesslog.py	2009-06-19 01:25:55 UTC (rev 4361)
+++ CalendarServer/trunk/twistedcaldav/accesslog.py	2009-06-19 23:24:17 UTC (rev 4362)
@@ -108,7 +108,7 @@
             # attribute to the request, so we can provide a little
             # more detail here.
             #
-            if hasattr(request, "submethod"):
+            if config.EnableExtendedAccessLog and hasattr(request, "submethod"):
                 method = "%s(%s)" % (request.method, request.submethod)
             else:
                 method = request.method
@@ -125,7 +125,7 @@
                 formats = [
                     format,
                     # Performance monitoring extensions
-                    'i=%(serverInstance)d t=%(timeSpent).1fms or=%(outstandingRequests)d',
+                    'i=%(serverInstance)s t=%(timeSpent).1f or=%(outstandingRequests)s',
                 ]
                 if hasattr(request, "extendedLogItems"):
                     for k, v in request.extendedLogItems.iteritems():
@@ -133,7 +133,7 @@
                         if " " in v:
                             v = '"%s"' % (v,)
                         formats.append("%s=%s" % (k, v))
-                    format = " ".join(formats)
+                format = " ".join(formats)
 
             formatArgs = {
                 "host"                : request.remoteAddr.host,
@@ -159,7 +159,7 @@
                 overloaded.transport.hostname,
                 self.logDateString(time.time()),
             )
-            if config.MoreAccessLogData:
+            if config.EnableExtendedAccessLog:
                 format_str += " [%s %s]"
                 format_data += (
                     overloaded.transport.server.port,

Modified: CalendarServer/trunk/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/extensions.py	2009-06-19 01:25:55 UTC (rev 4361)
+++ CalendarServer/trunk/twistedcaldav/extensions.py	2009-06-19 23:24:17 UTC (rev 4362)
@@ -683,6 +683,12 @@
         (calendarserver_namespace, "record-type"),
     )
 
+    def renderHTTP(self, request):
+        log.info("%s %s %s" % (request.method, urllib.unquote(request.uri), "HTTP/%s.%s" % request.clientproto))
+        return super(DAVPrincipalResource, self).renderHTTP(request)
+
+    http_REPORT = http_REPORT
+
     @inlineCallbacks
     def readProperty(self, property, request):
         if type(property) is tuple:

Modified: CalendarServer/trunk/twistedcaldav/method/propfind.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/propfind.py	2009-06-19 01:25:55 UTC (rev 4361)
+++ CalendarServer/trunk/twistedcaldav/method/propfind.py	2009-06-19 23:24:17 UTC (rev 4362)
@@ -187,6 +187,11 @@
     
         xml_responses.append(xml_response)
             
+
+    if not hasattr(request, "extendedLogItems"):
+        request.extendedLogItems = {}
+    request.extendedLogItems["responses"] = len(xml_responses)
+
     #
     # Return response
     #

Modified: CalendarServer/trunk/twistedcaldav/method/report_calquery.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_calquery.py	2009-06-19 01:25:55 UTC (rev 4361)
+++ CalendarServer/trunk/twistedcaldav/method/report_calquery.py	2009-06-19 23:24:17 UTC (rev 4362)
@@ -243,4 +243,8 @@
         log.err("Too many matching components in calendar-query report")
         raise HTTPError(ErrorResponse(responsecode.FORBIDDEN, davxml.NumberOfMatchesWithinLimits()))
     
+    if not hasattr(request, "extendedLogItems"):
+        request.extendedLogItems = {}
+    request.extendedLogItems["responses"] = len(responses)
+
     returnValue(MultiStatusResponse(responses))

Modified: CalendarServer/trunk/twistedcaldav/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2009-06-19 01:25:55 UTC (rev 4361)
+++ CalendarServer/trunk/twistedcaldav/scheduling/implicit.py	2009-06-19 23:24:17 UTC (rev 4362)
@@ -290,7 +290,10 @@
         finally:
             delattr(self.request, "doing_attendee_refresh")
 
-        returnValue(result)
+        if result:
+            if not hasattr(self.request, "extendedLogItems"):
+                self.request.extendedLogItems = {}
+            self.request.extendedLogItems["itip.refreshes"] = result
 
     @inlineCallbacks
     def sendAttendeeReply(self, request, resource, calendar, attendee):
@@ -634,12 +637,16 @@
     def scheduleWithAttendees(self):
         
         # First process cancelled attendees
-        yield self.processCancels()
+        total = (yield self.processCancels())
         
         # Process regular requests next
         if self.action in ("create", "modify",):
-            yield self.processRequests()
+            total += (yield self.processRequests())
 
+        if not hasattr(self.request, "extendedLogItems"):
+            self.request.extendedLogItems = {}
+        self.request.extendedLogItems["itip.requests"] = total
+
     @inlineCallbacks
     def processCancels(self):
         
@@ -650,7 +657,8 @@
         aggregated = {}
         for attendee, rid in self.cancelledAttendees:
             aggregated.setdefault(attendee, []).append(rid)
-            
+        
+        count = 0
         for attendee, rids in aggregated.iteritems():
             
             # Don't send message back to the ORGANIZER
@@ -677,6 +685,10 @@
             response = (yield scheduler.doSchedulingViaPUT(self.originator, (attendee,), itipmsg, self.internal_request))
             self.handleSchedulingResponse(response, True)
             
+            count += 1
+            
+        returnValue(count)
+            
     @inlineCallbacks
     def processRequests(self):
         
@@ -684,6 +696,7 @@
         # being requested, but for now we will do one scheduling message per attendee.
 
         # Do one per attendee
+        count = 0
         for attendee in self.attendees:
 
             # Don't send message back to the ORGANIZER
@@ -709,6 +722,10 @@
                 log.info("Implicit REQUEST - organizer: '%s' to attendee: '%s', UID: '%s'" % (self.organizer, attendee, self.uid,))
                 response = (yield scheduler.doSchedulingViaPUT(self.originator, (attendee,), itipmsg, self.internal_request))
                 self.handleSchedulingResponse(response, True)
+                
+                count += 1
+                
+        returnValue(count)
 
     def handleSchedulingResponse(self, response, is_organizer):
         
@@ -846,6 +863,10 @@
 
     def scheduleWithOrganizer(self, changedRids=None):
 
+        if not hasattr(self.request, "extendedLogItems"):
+            self.request.extendedLogItems = {}
+        self.request.extendedLogItems["itip.reply"] = "reply"
+    
         itipmsg = iTipGenerator.generateAttendeeReply(self.calendar, self.attendee, changedRids=changedRids)
 
         # Send scheduling message
@@ -853,6 +874,10 @@
 
     def scheduleCancelWithOrganizer(self):
 
+        if not hasattr(self.request, "extendedLogItems"):
+            self.request.extendedLogItems = {}
+        self.request.extendedLogItems["itip.reply"] = "cancel"
+    
         itipmsg = iTipGenerator.generateAttendeeReply(self.calendar, self.attendee, force_decline=True)
 
         # Send scheduling message

Modified: CalendarServer/trunk/twistedcaldav/scheduling/processing.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/processing.py	2009-06-19 01:25:55 UTC (rev 4361)
+++ CalendarServer/trunk/twistedcaldav/scheduling/processing.py	2009-06-19 23:24:17 UTC (rev 4362)
@@ -190,7 +190,7 @@
 
             # Only update other attendees when the partstat was changed by the reply
             if partstatChanged:
-                self.updateAllAttendeesExceptSome(recipient_calendar_resource, (attendeeReplying,))
+                yield self.updateAllAttendeesExceptSome(recipient_calendar_resource, (attendeeReplying,))
 
             result = (True, False, changes,)
 
@@ -200,6 +200,7 @@
 
         returnValue(result)
 
+    @inlineCallbacks
     def updateAllAttendeesExceptSome(self, resource, attendees):
         """
         Send an update out to all attendees except the specified ones, to refresh the others due to a change
@@ -211,7 +212,7 @@
         
         from twistedcaldav.scheduling.implicit import ImplicitScheduler
         scheduler = ImplicitScheduler()
-        scheduler.refreshAllAttendeesExceptSome(self.request, resource, self.recipient_calendar, attendees)
+        yield scheduler.refreshAllAttendeesExceptSome(self.request, resource, self.recipient_calendar, attendees)
 
     @inlineCallbacks
     def doImplicitAttendee(self):

Modified: CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py	2009-06-19 01:25:55 UTC (rev 4361)
+++ CalendarServer/trunk/twistedcaldav/scheduling/scheduler.py	2009-06-19 23:24:17 UTC (rev 4362)
@@ -91,6 +91,10 @@
         else:
             yield self.loadFromRequestData()
 
+        if not hasattr(self.request, "extendedLogItems"):
+            self.request.extendedLogItems = {}
+        self.request.extendedLogItems["recipients"] = len(self.recipients)
+    
         # Do some extra authorization checks
         self.checkAuthorization()
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20090619/ad15707d/attachment-0001.html>


More information about the calendarserver-changes mailing list