[CalendarServer-changes] [5714] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Jun 10 08:17:34 PDT 2010


Revision: 5714
          http://trac.macosforge.org/projects/calendarserver/changeset/5714
Author:   cdaboo at apple.com
Date:     2010-06-10 08:17:29 -0700 (Thu, 10 Jun 2010)
Log Message:
-----------
Add method into the HTTP logging files names to make it easier to find specific requests.

Modified Paths:
--------------
    CalendarServer/trunk/twext/web2/channel/http.py
    CalendarServer/trunk/twistedcaldav/accounting.py

Modified: CalendarServer/trunk/twext/web2/channel/http.py
===================================================================
--- CalendarServer/trunk/twext/web2/channel/http.py	2010-06-09 22:17:47 UTC (rev 5713)
+++ CalendarServer/trunk/twext/web2/channel/http.py	2010-06-10 15:17:29 UTC (rev 5714)
@@ -1124,7 +1124,7 @@
         if self.logData is not None:
             doneTime = time.time()
             self.logData.response.append("\r\n\r\n<<<< Response complete at: %.3f (elapsed: %.1f ms)\r\n" % (doneTime, 1000 * (doneTime - self.startTime),))
-            accounting.emitAccounting("HTTP", "", "".join(self.logData.request) + "".join(self.logData.response))
+            accounting.emitAccounting("HTTP", "", "".join(self.logData.request) + "".join(self.logData.response), self.command)
 
 HTTPChannel.chanRequestFactory = HTTPLoggingChannelRequest
 

Modified: CalendarServer/trunk/twistedcaldav/accounting.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/accounting.py	2010-06-09 22:17:47 UTC (rev 5713)
+++ CalendarServer/trunk/twistedcaldav/accounting.py	2010-06-10 15:17:29 UTC (rev 5714)
@@ -69,7 +69,7 @@
 
     return False
 
-def emitAccounting(category, principal, data):
+def emitAccounting(category, principal, data, tag=None):
     """
     Write the supplied data to the appropriate location for the given
     category and principal.
@@ -111,10 +111,14 @@
         if not os.path.isdir(os.path.join(logRoot, logDirectory)):
             os.makedirs(os.path.join(logRoot, logDirectory))
             logFilename = "%s-01" % (logFilename,)
+            if tag:
+                logFilename += " (%s)" % (tag,)
         else:
             index = 1
             while True:
                 path = "%s-%02d" % (logFilename, index)
+                if tag:
+                    path += " (%s)" % (tag,)
                 if not os.path.isfile(os.path.join(logRoot, path)):
                     logFilename = path
                     break
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100610/c6971846/attachment.html>


More information about the calendarserver-changes mailing list