[CalendarServer-changes] [13409] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri May 2 14:02:52 PDT 2014
Revision: 13409
http://trac.calendarserver.org//changeset/13409
Author: sagen at apple.com
Date: 2014-05-02 14:02:52 -0700 (Fri, 02 May 2014)
Log Message:
-----------
Postgres logs will live inside LogRoot on OS X Server
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tap/util.py
CalendarServer/trunk/conf/caldavd-apple.plist
CalendarServer/trunk/twistedcaldav/stdconfig.py
CalendarServer/trunk/txdav/base/datastore/subpostgres.py
Modified: CalendarServer/trunk/calendarserver/tap/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/util.py 2014-05-02 20:07:26 UTC (rev 13408)
+++ CalendarServer/trunk/calendarserver/tap/util.py 2014-05-02 21:02:52 UTC (rev 13409)
@@ -127,6 +127,7 @@
databaseName=config.Postgres.DatabaseName,
clusterName=config.Postgres.ClusterName,
logFile=config.Postgres.LogFile,
+ logDirectory=config.LogRoot if config.Postgres.LogRotation else "",
socketDir=config.Postgres.SocketDirectory,
listenAddresses=config.Postgres.ListenAddresses,
sharedBuffers=config.Postgres.SharedBuffers,
Modified: CalendarServer/trunk/conf/caldavd-apple.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-apple.plist 2014-05-02 20:07:26 UTC (rev 13408)
+++ CalendarServer/trunk/conf/caldavd-apple.plist 2014-05-02 21:02:52 UTC (rev 13409)
@@ -111,11 +111,6 @@
<string>-c log_lock_waits=TRUE</string>
<string>-c deadlock_timeout=10</string>
<string>-c log_line_prefix='%m [%p] '</string>
- <string>-c logging_collector=on</string>
- <string>-c log_truncate_on_rotation=on</string>
- <string>-c log_directory=/var/log/caldavd/postgresql</string>
- <string>-c log_filename=postgresql_%w.log</string>
- <string>-c log_rotation_age=1440</string>
</array>
<key>ExtraConnections</key>
<integer>20</integer>
@@ -125,6 +120,8 @@
<string>xpg_ctl.log</string>
<key>SocketDirectory</key>
<string>/var/run/caldavd/PostgresSocket</string>
+ <key>LogRotation</key>
+ <true/>
</dict>
<!-- Data root -->
@@ -212,7 +209,7 @@
<dict>
<key>type</key>
<string>twistedcaldav.directory.appleopendirectory.OpenDirectoryService</string>
-
+
<key>params</key>
<dict>
<key>node</key>
Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py 2014-05-02 20:07:26 UTC (rev 13408)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py 2014-05-02 21:02:52 UTC (rev 13409)
@@ -990,6 +990,7 @@
"DatabaseName": "caldav",
"ClusterName": "cluster",
"LogFile": "postgres.log",
+ "LogRotation": False,
"SocketDirectory": "",
"ListenAddresses": [],
"SharedBuffers": 0, # BuffersToConnectionsRatio * MaxConnections
Modified: CalendarServer/trunk/txdav/base/datastore/subpostgres.py
===================================================================
--- CalendarServer/trunk/txdav/base/datastore/subpostgres.py 2014-05-02 20:07:26 UTC (rev 13408)
+++ CalendarServer/trunk/txdav/base/datastore/subpostgres.py 2014-05-02 21:02:52 UTC (rev 13409)
@@ -167,7 +167,9 @@
def __init__(self, dataStoreDirectory, subServiceFactory,
schema, resetSchema=False, databaseName='subpostgres',
clusterName="cluster",
- logFile="postgres.log", socketDir="",
+ logFile="postgres.log",
+ logDirectory="",
+ socketDir="",
listenAddresses=[], sharedBuffers=30,
maxConnections=20, options=[],
testMode=False,
@@ -218,6 +220,7 @@
# Make logFile absolute in case the working directory of postgres is
# elsewhere:
self.logFile = os.path.abspath(logFile)
+ self.logDirectory = os.path.abspath(logDirectory) if logDirectory else ""
# Always use our own configured socket dir in case the built-in postgres tries to use
# a directory we don't have permissions for
@@ -420,8 +423,14 @@
options.append("-c standard_conforming_strings=on")
options.append("-c unix_socket_permissions=0770")
options.extend(self.options)
+ if self.logDirectory: # tell postgres to rotate logs
+ options.append("-c log_directory={}".format(self.logDirectory))
+ options.append("-c log_truncate_on_rotation=on")
+ options.append("-c log_filename=postgresql_%w.log")
+ options.append("-c log_rotation_age=1440")
+ options.append("-c logging_collector=on")
- log.warn("Requesting postgres start via {cmd}", cmd=pgCtl)
+ log.warn("Requesting postgres start via {cmd} {opts}", cmd=pgCtl, opts=options)
self.reactor.spawnProcess(
monitor, pgCtl,
[
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140502/85061882/attachment.html>
More information about the calendarserver-changes
mailing list