[CalendarServer-changes] [11626] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Wed Aug 21 12:49:00 PDT 2013
Revision: 11626
http://trac.calendarserver.org//changeset/11626
Author: sagen at apple.com
Date: 2013-08-21 12:49:00 -0700 (Wed, 21 Aug 2013)
Log Message:
-----------
Write to agent.log and roll it ourselves.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tap/caldav.py
CalendarServer/trunk/twistedcaldav/stdconfig.py
Modified: CalendarServer/trunk/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/caldav.py 2013-08-21 15:40:05 UTC (rev 11625)
+++ CalendarServer/trunk/calendarserver/tap/caldav.py 2013-08-21 19:49:00 UTC (rev 11626)
@@ -225,14 +225,31 @@
""" Registers a rotating file logger for error logging, if
config.ErrorLogEnabled is True. """
+ def __init__(self, logEnabled, logPath, logRotateLength, logMaxFiles):
+ """
+ @param logEnabled: Whether to write to a log file
+ @type logEnabled: C{boolean}
+ @param logPath: the full path to the log file
+ @type logPath: C{str}
+ @param logRotateLength: rotate when files exceed this many bytes
+ @type logRotateLength: C{int}
+ @param logMaxFiles: keep at most this many files
+ @type logMaxFiles: C{int}
+ """
+ MultiService.__init__(self)
+ self.logEnabled = logEnabled
+ self.logPath = logPath
+ self.logRotateLength = logRotateLength
+ self.logMaxFiles = logMaxFiles
+
def setServiceParent(self, app):
MultiService.setServiceParent(self, app)
- if config.ErrorLogEnabled:
+ if self.logEnabled:
errorLogFile = LogFile.fromFullPath(
- config.ErrorLogFile,
- rotateLength=config.ErrorLogRotateMB * 1024 * 1024,
- maxRotatedFiles=config.ErrorLogMaxRotatedFiles
+ self.logPath,
+ rotateLength = self.logRotateLength,
+ maxRotatedFiles = self.logMaxFiles
)
errorLogObserver = FileLogObserver(errorLogFile).emit
@@ -251,7 +268,9 @@
def __init__(self, logObserver):
self.logObserver = logObserver # accesslog observer
- MultiService.__init__(self)
+ ErrorLoggingMultiService.__init__(self, config.ErrorLogEnabled,
+ config.ErrorLogFile, config.ErrorLogRotateMB * 1024 * 1024,
+ config.ErrorLogMaxRotatedFiles)
def privilegedStartService(self):
@@ -1269,7 +1288,15 @@
return makeAgentService(store)
uid, gid = getSystemIDs(config.UserName, config.GroupName)
- return self.storageService(agentServiceCreator, None, uid=uid, gid=gid)
+ svc = self.storageService(agentServiceCreator, None, uid=uid, gid=gid)
+ agentLoggingService = ErrorLoggingMultiService(
+ config.ErrorLogEnabled,
+ config.AgentLogFile,
+ config.ErrorLogRotateMB * 1024 * 1024,
+ config.ErrorLogMaxRotatedFiles
+ )
+ svc.setServiceParent(agentLoggingService)
+ return agentLoggingService
def storageService(self, createMainService, logObserver, uid=None, gid=None):
@@ -1428,7 +1455,12 @@
Create a master service to coordinate a multi-process configuration,
spawning subprocesses that use L{makeService_Slave} to perform work.
"""
- s = ErrorLoggingMultiService()
+ s = ErrorLoggingMultiService(
+ config.ErrorLogEnabled,
+ config.ErrorLogFile,
+ config.ErrorLogRotateMB * 1024 * 1024,
+ config.ErrorLogMaxRotatedFiles
+ )
# Add a service to re-exec the master when it receives SIGHUP
ReExecService(config.PIDFile).setServiceParent(s)
Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py 2013-08-21 15:40:05 UTC (rev 11625)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py 2013-08-21 19:49:00 UTC (rev 11626)
@@ -449,6 +449,7 @@
#
"AccessLogFile" : "access.log", # Apache-style access log
"ErrorLogFile" : "error.log", # Server activity log
+ "AgentLogFile" : "agent.log", # Agent activity log
"ErrorLogEnabled" : True, # True = use log file, False = stdout
"ErrorLogRotateMB" : 10, # Rotate error log after so many megabytes
"ErrorLogMaxRotatedFiles" : 5, # Retain this many error log files
@@ -1080,6 +1081,7 @@
("ConfigRoot", ("Scheduling", "iSchedule", "DKIM", "PrivateExchanges",)),
("LogRoot", "AccessLogFile"),
("LogRoot", "ErrorLogFile"),
+ ("LogRoot", "AgentLogFile"),
("LogRoot", ("Postgres", "LogFile",)),
("LogRoot", ("LogDatabase", "StatisticsLogFile",)),
("LogRoot", "AccountingLogRoot"),
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130821/ecd89f34/attachment.html>
More information about the calendarserver-changes
mailing list