[CalendarServer-changes] [11242] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri May 24 11:05:29 PDT 2013


Revision: 11242
          http://trac.calendarserver.org//changeset/11242
Author:   wsanchez at apple.com
Date:     2013-05-24 11:05:29 -0700 (Fri, 24 May 2013)
Log Message:
-----------
Use NamedConstant's for log levels.

Remove log.err() and log.msg() from the interface for Logger.

Add TwistedCompatibleLogger which adds log.err() and log.msg(), for use when injecting our loggers into Twisted's modules.

Add failure() to Logger, for exception/Failure handling similar to Twisted's log.err().

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/accesslog.py
    CalendarServer/trunk/calendarserver/tap/caldav.py
    CalendarServer/trunk/calendarserver/tap/test/test_caldav.py
    CalendarServer/trunk/calendarserver/tools/calverify.py
    CalendarServer/trunk/calendarserver/tools/dkimtool.py
    CalendarServer/trunk/calendarserver/tools/export.py
    CalendarServer/trunk/calendarserver/tools/loadaugmentdb.py
    CalendarServer/trunk/calendarserver/tools/migrate_verify.py
    CalendarServer/trunk/calendarserver/tools/obliterate.py
    CalendarServer/trunk/calendarserver/tools/shell/cmd.py
    CalendarServer/trunk/calendarserver/tools/shell/terminal.py
    CalendarServer/trunk/calendarserver/tools/shell/vfs.py
    CalendarServer/trunk/calendarserver/tools/upgrade.py
    CalendarServer/trunk/twext/internet/sendfdport.py
    CalendarServer/trunk/twext/internet/tcp.py
    CalendarServer/trunk/twext/protocols/memcache.py
    CalendarServer/trunk/twext/python/log.py
    CalendarServer/trunk/twext/python/test/test_log.py
    CalendarServer/trunk/twext/web2/channel/http.py
    CalendarServer/trunk/twext/web2/dav/fileop.py
    CalendarServer/trunk/twext/web2/dav/http.py
    CalendarServer/trunk/twext/web2/dav/method/acl.py
    CalendarServer/trunk/twext/web2/dav/method/copymove.py
    CalendarServer/trunk/twext/web2/dav/method/delete.py
    CalendarServer/trunk/twext/web2/dav/method/delete_common.py
    CalendarServer/trunk/twext/web2/dav/method/mkcol.py
    CalendarServer/trunk/twext/web2/dav/method/prop_common.py
    CalendarServer/trunk/twext/web2/dav/method/propfind.py
    CalendarServer/trunk/twext/web2/dav/method/proppatch.py
    CalendarServer/trunk/twext/web2/dav/method/put.py
    CalendarServer/trunk/twext/web2/dav/method/put_common.py
    CalendarServer/trunk/twext/web2/dav/method/report.py
    CalendarServer/trunk/twext/web2/dav/method/report_acl_principal_prop_set.py
    CalendarServer/trunk/twext/web2/dav/method/report_expand.py
    CalendarServer/trunk/twext/web2/dav/method/report_principal_match.py
    CalendarServer/trunk/twext/web2/dav/method/report_principal_property_search.py
    CalendarServer/trunk/twext/web2/dav/method/report_principal_search_property_set.py
    CalendarServer/trunk/twext/web2/dav/resource.py
    CalendarServer/trunk/twext/web2/dav/static.py
    CalendarServer/trunk/twext/web2/dav/test/util.py
    CalendarServer/trunk/twext/web2/dav/util.py
    CalendarServer/trunk/twext/web2/http.py
    CalendarServer/trunk/twext/web2/log.py
    CalendarServer/trunk/twext/web2/metafd.py
    CalendarServer/trunk/twext/web2/server.py
    CalendarServer/trunk/twext/web2/stream.py
    CalendarServer/trunk/twistedcaldav/caldavxml.py
    CalendarServer/trunk/twistedcaldav/client/geturl.py
    CalendarServer/trunk/twistedcaldav/database.py
    CalendarServer/trunk/twistedcaldav/directory/principal.py
    CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py
    CalendarServer/trunk/twistedcaldav/extensions.py
    CalendarServer/trunk/twistedcaldav/freebusyurl.py
    CalendarServer/trunk/twistedcaldav/method/mkcalendar.py
    CalendarServer/trunk/twistedcaldav/method/mkcol.py
    CalendarServer/trunk/twistedcaldav/method/propfind.py
    CalendarServer/trunk/twistedcaldav/method/report.py
    CalendarServer/trunk/twistedcaldav/method/report_addressbook_query.py
    CalendarServer/trunk/twistedcaldav/method/report_calendar_query.py
    CalendarServer/trunk/twistedcaldav/method/report_common.py
    CalendarServer/trunk/twistedcaldav/method/report_freebusy.py
    CalendarServer/trunk/twistedcaldav/method/report_multiget_common.py
    CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py
    CalendarServer/trunk/twistedcaldav/query/calendarqueryfilter.py
    CalendarServer/trunk/twistedcaldav/resource.py
    CalendarServer/trunk/twistedcaldav/sql.py
    CalendarServer/trunk/twistedcaldav/stdconfig.py
    CalendarServer/trunk/twistedcaldav/storebridge.py
    CalendarServer/trunk/twistedcaldav/test/test_cache.py
    CalendarServer/trunk/twistedcaldav/test/test_config.py
    CalendarServer/trunk/twistedcaldav/upgrade.py
    CalendarServer/trunk/txdav/base/datastore/subpostgres.py
    CalendarServer/trunk/txdav/base/datastore/util.py
    CalendarServer/trunk/txdav/caldav/datastore/index_file.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/delivery.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/scheduler.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/freebusy.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/delivery.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/scheduler.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
    CalendarServer/trunk/txdav/caldav/datastore/scheduling/scheduler.py
    CalendarServer/trunk/txdav/caldav/datastore/sql.py
    CalendarServer/trunk/txdav/caldav/datastore/util.py
    CalendarServer/trunk/txdav/carddav/datastore/index_file.py
    CalendarServer/trunk/txdav/common/datastore/sql.py
    CalendarServer/trunk/txdav/common/datastore/test/util.py
    CalendarServer/trunk/txdav/xml/base.py

Modified: CalendarServer/trunk/calendarserver/accesslog.py
===================================================================
--- CalendarServer/trunk/calendarserver/accesslog.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/calendarserver/accesslog.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -366,10 +366,10 @@
 
         newpath = "%s.%s" % (self.logpath, self.suffix(self.lastDate))
         if os.path.exists(newpath):
-            log.msg("Cannot rotate log file to %s because it already exists." % (newpath,))
+            log.info("Cannot rotate log file to %s because it already exists." % (newpath,))
             return
         self.accessLog("Log closed - rotating: [%s]." % (datetime.datetime.now().ctime(),), False)
-        log.msg("Rotating log file to: %s" % (newpath,), system="Logging")
+        log.info("Rotating log file to: %s" % (newpath,), system="Logging")
         self.f.close()
         os.rename(self.logpath, newpath)
         self._open()

Modified: CalendarServer/trunk/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/caldav.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/calendarserver/tap/caldav.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -57,7 +57,7 @@
 from twistedcaldav.stdconfig import DEFAULT_CONFIG, DEFAULT_CONFIG_FILE
 from twext.web2.server import Site
 from twext.python.log import Logger, LoggingMixIn
-from twext.python.log import logLevelForNamespace, setLogLevelForNamespace
+from twext.python.log import LogLevel, logLevelForNamespace, setLogLevelForNamespace
 from twext.python.filepath import CachingFilePath
 from twext.internet.ssl import ChainingOpenSSLContextFactory
 from twext.internet.tcp import MaxAcceptTCPServer, MaxAcceptSSLServer
@@ -887,7 +887,7 @@
         # that during startup
         #
         oldLogLevel = logLevelForNamespace(None)
-        setLogLevelForNamespace(None, "info")
+        setLogLevelForNamespace(None, LogLevel.info)
 
         # Note: 'additional' was used for IMIP reply resource, and perhaps
         # we can remove this

Modified: CalendarServer/trunk/calendarserver/tap/test/test_caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/test/test_caldav.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/calendarserver/tap/test/test_caldav.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -24,11 +24,11 @@
 
 from zope.interface import implements
 
+from twisted.python import log as logging
 from twisted.python.threadable import isInIOThread
 from twisted.internet.reactor import callFromThread
 from twisted.python.usage import Options, UsageError
 from twisted.python.reflect import namedAny
-from twisted.python import log
 from twisted.python.procutils import which
 
 from twisted.internet.interfaces import IProcessTransport, IReactorProcess
@@ -36,16 +36,15 @@
 from twisted.internet.defer import Deferred, inlineCallbacks, passthru, succeed
 from twisted.internet.task import Clock
 from twisted.internet import reactor
-
 from twisted.application.service import (IService, IServiceCollection,
                                          MultiService)
 from twisted.application import internet
 
+from twext.python.log import Logger
+from twext.python.filepath import CachingFilePath as FilePath
+from twext.python.plistlib import writePlist #@UnresolvedImport
 from twext.web2.dav import auth
 from twext.web2.log import LogWrapperResource
-from twext.python.filepath import CachingFilePath as FilePath
-
-from twext.python.plistlib import writePlist #@UnresolvedImport
 from twext.internet.tcp import MaxAcceptTCPServer, MaxAcceptSSLServer
 
 from twistedcaldav.config import config, ConfigDict, ConfigurationError
@@ -68,7 +67,9 @@
 from twext.enterprise.queue import PeerConnectionPool, LocalQueuer
 from StringIO import StringIO
 
+log = Logger()
 
+
 # Points to top of source tree.
 sourceRoot = dirname(dirname(dirname(dirname(abspath(__file__)))))
 
@@ -171,7 +172,7 @@
             return CalDAVOptions.loadConfiguration(self)
         finally:
             sys.stdout = oldout
-            log.msg(
+            log.info(
                 "load configuration console output: %s" % newout.getvalue()
             )
 
@@ -1024,8 +1025,8 @@
                 if m == '[Dummy] z':
                     d.callback("done")
 
-        log.addObserver(tempObserver)
-        self.addCleanup(log.removeObserver, tempObserver)
+        logging.addObserver(tempObserver)
+        self.addCleanup(logging.removeObserver, tempObserver)
         d = Deferred()
         def assertions(result):
             self.assertEquals(["[Dummy] x",

Modified: CalendarServer/trunk/calendarserver/tools/calverify.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/calverify.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/calendarserver/tools/calverify.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -40,11 +40,13 @@
 
 """
 
-from calendarserver.tools.cmdline import utilityMain
+import base64
+import collections
+import sys
+import time
+import traceback
+import uuid
 
-from calendarserver.tools import tables
-from calendarserver.tools.util import getDirectory
-
 from pycalendar import definitions
 from pycalendar.calendar import PyCalendar
 from pycalendar.datetime import PyCalendarDateTime
@@ -52,13 +54,14 @@
 from pycalendar.period import PyCalendarPeriod
 from pycalendar.timezone import PyCalendarTimezone
 
-from twext.enterprise.dal.syntax import Select, Parameter, Count
-
 from twisted.application.service import Service
 from twisted.internet.defer import inlineCallbacks, returnValue
-from twisted.python import log, usage
+from twisted.python import usage
 from twisted.python.usage import Options
 
+from twext.python.log import Logger
+from twext.enterprise.dal.syntax import Select, Parameter, Count
+
 from twistedcaldav.datafilters.peruserdata import PerUserDataFilter
 from twistedcaldav.dateops import pyCalendarTodatetime
 from twistedcaldav.directory.directory import DirectoryService
@@ -72,13 +75,15 @@
 from txdav.common.datastore.sql_tables import schema, _BIND_MODE_OWN
 from txdav.common.icommondatastore import InternalDataStoreError
 
-import base64
-import collections
-import sys
-import time
-import traceback
-import uuid
+from calendarserver.tools.cmdline import utilityMain
 
+from calendarserver.tools import tables
+from calendarserver.tools.util import getDirectory
+
+log = Logger()
+
+
+
 # Monkey patch
 def new_validRecurrenceIDs(self, doFix=True):
 
@@ -421,7 +426,7 @@
             yield self.doAction()
             self.output.close()
         except:
-            log.err()
+            log.failure()
 
         self.reactor.stop()
 

Modified: CalendarServer/trunk/calendarserver/tools/dkimtool.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/dkimtool.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/calendarserver/tools/dkimtool.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -18,7 +18,7 @@
 from Crypto.PublicKey import RSA
 from StringIO import StringIO
 
-from twext.python.log import setLogLevelForNamespace, StandardIOObserver
+from twext.python.log import LogLevel, setLogLevelForNamespace, StandardIOObserver
 from twext.web2.client.http import ClientRequest
 from twext.web2.http_headers import Headers
 from twext.web2.stream import MemoryStream
@@ -66,7 +66,7 @@
 def _doRequest(options):
 
     if options["verbose"]:
-        setLogLevelForNamespace("txdav.caldav.datastore.scheduling.ischedule.dkim", "debug")
+        setLogLevelForNamespace("txdav.caldav.datastore.scheduling.ischedule.dkim", LogLevel.debug)
 
     # Parse the HTTP file
     request = open(options["request"]).read()
@@ -299,7 +299,7 @@
     observer.start()
 
     if options["verbose"]:
-        setLogLevelForNamespace("txdav.caldav.datastore.scheduling.ischedule.dkim", "debug")
+        setLogLevelForNamespace("txdav.caldav.datastore.scheduling.ischedule.dkim", LogLevel.debug)
 
     if options["key-gen"]:
         _doKeyGeneration(options)

Modified: CalendarServer/trunk/calendarserver/tools/export.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/export.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/calendarserver/tools/export.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -41,16 +41,19 @@
 
 from twisted.python.text import wordWrap
 from twisted.python.usage import Options, UsageError
-from twisted.python import log
 from twisted.internet.defer import inlineCallbacks, returnValue
+from twisted.application.service import Service
 
+from twext.python.log import Logger
 from twistedcaldav.ical import Component
 
 from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
 from calendarserver.tools.cmdline import utilityMain
-from twisted.application.service import Service
 
+log = Logger()
 
+
+
 def usage(e=None):
     if e:
         print(e)
@@ -323,7 +326,7 @@
             # update stuff needed to happen, don't want to undo it.
             self.output.close()
         except:
-            log.err()
+            log.failure()
 
         self.reactor.stop()
 

Modified: CalendarServer/trunk/calendarserver/tools/loadaugmentdb.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/loadaugmentdb.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/calendarserver/tools/loadaugmentdb.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -24,7 +24,7 @@
 from grp import getgrnam
 from pwd import getpwnam
 
-from twext.python.log import setLogLevelForNamespace
+from twext.python.log import LogLevel, setLogLevelForNamespace
 
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks
@@ -109,7 +109,7 @@
     #
     try:
         loadConfig(configFileName)
-        setLogLevelForNamespace(None, "warn")
+        setLogLevelForNamespace(None, LogLevel.warn)
 
         # Shed privileges
         if config.UserName and config.GroupName and os.getuid() == 0:

Modified: CalendarServer/trunk/calendarserver/tools/migrate_verify.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/migrate_verify.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/calendarserver/tools/migrate_verify.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -26,18 +26,25 @@
 not migrated are logged.
 """
 
-from calendarserver.tools.cmdline import utilityMain
+import os
+import sys
+
 from twisted.application.service import Service
 from twisted.internet.defer import inlineCallbacks, returnValue
-from twisted.python import log
 from twisted.python.text import wordWrap
 from twisted.python.usage import Options
+
+from twext.python.log import Logger
 from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
-import os
-import sys
 
+from calendarserver.tools.cmdline import utilityMain
+
+log = Logger()
+
 VERSION = "1"
 
+
+
 def usage(e=None):
     if e:
         print(e)
@@ -156,7 +163,7 @@
         except ConfigError:
             pass
         except:
-            log.err()
+            log.failure()
 
         self.reactor.stop()
 

Modified: CalendarServer/trunk/calendarserver/tools/obliterate.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/obliterate.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/calendarserver/tools/obliterate.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -26,20 +26,28 @@
 have access to it as they are not enabled on the server.
 """
 
-from calendarserver.tools.cmdline import utilityMain
-from twext.enterprise.dal.syntax import Parameter, Delete, Select, Union, \
-    CompoundComparison, ExpressionSyntax, Count
+import os
+import sys
+import time
+
 from twisted.application.service import Service
 from twisted.internet.defer import inlineCallbacks, returnValue
-from twisted.python import log
 from twisted.python.text import wordWrap
 from twisted.python.usage import Options
+
+from twext.enterprise.dal.syntax import Parameter, Delete, Select, Union, \
+    CompoundComparison, ExpressionSyntax, Count
+from twext.python.log import Logger
+
 from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
 from txdav.common.datastore.sql_tables import schema, _BIND_MODE_OWN
-import os
-import sys
-import time
 
+from calendarserver.tools.cmdline import utilityMain
+
+log = Logger()
+
+
+
 VERSION = "1"
 
 def usage(e=None):
@@ -178,7 +186,7 @@
         except ConfigError:
             pass
         except:
-            log.err()
+            log.failure()
 
         self.reactor.stop()
 

Modified: CalendarServer/trunk/calendarserver/tools/shell/cmd.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/cmd.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/calendarserver/tools/shell/cmd.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -27,7 +27,7 @@
 
 from getopt import getopt
 
-#from twisted.python import log
+from twext.python.log import Logger
 from twisted.internet.defer import succeed
 from twisted.internet.defer import inlineCallbacks, returnValue
 
@@ -42,7 +42,10 @@
 from calendarserver.tools.shell.vfs import Folder, RootFolder
 from calendarserver.tools.shell.directory import findRecords, summarizeRecords, recordInfo
 
+log = Logger()
 
+
+
 class UsageError(Exception):
     """
     Usage error.
@@ -469,7 +472,7 @@
         if not isinstance(wd, Folder):
             raise NotFoundError("Not a folder: %s" % (wd,))
 
-        #log.msg("wd -> %s" % (wd,))
+        #log.info("wd -> %s" % (wd,))
         self.wd = wd
 
 

Modified: CalendarServer/trunk/calendarserver/tools/shell/terminal.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/terminal.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/calendarserver/tools/shell/terminal.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -35,7 +35,6 @@
 import termios
 from shlex import shlex
 
-from twisted.python import log
 from twisted.python.failure import Failure
 from twisted.python.text import wordWrap
 from twisted.python.usage import Options, UsageError
@@ -46,6 +45,8 @@
 from twisted.conch.insults.insults import ServerProtocol
 from twisted.application.service import Service
 
+from twext.python.log import Logger
+
 from txdav.common.icommondatastore import NotFoundError
 
 from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
@@ -54,7 +55,10 @@
 from calendarserver.tools.util import getDirectory
 from calendarserver.tools.shell.cmd import Commands, UsageError as CommandUsageError
 
+log = Logger()
 
+
+
 def usage(e=None):
     if e:
         print(e)
@@ -291,7 +295,7 @@
             except Exception, e:
                 self.handleFailure(Failure(e))
                 return
-            log.msg("COMPLETIONS: %r" % (completions,))
+            log.info("COMPLETIONS: %r" % (completions,))
         else:
             # Completing command name
             completions = tuple(self.commands.complete_commands(cmd))
@@ -325,7 +329,7 @@
             self.terminal.nextLine()
         self.terminal.write("Error: %s !!!" % (f.value,))
         if not f.check(NotImplementedError, NotFoundError):
-            log.msg(f.getTraceback())
+            log.info(f.getTraceback())
         self.resetInputLine()
 
     #

Modified: CalendarServer/trunk/calendarserver/tools/shell/vfs.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/shell/vfs.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/calendarserver/tools/shell/vfs.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -41,10 +41,11 @@
 from cStringIO import StringIO
 from time import strftime, localtime
 
-from twisted.python import log
 from twisted.internet.defer import succeed
 from twisted.internet.defer import inlineCallbacks, returnValue
 
+from twext.python.log import Logger
+
 from txdav.common.icommondatastore import NotFoundError
 
 from twistedcaldav.ical import InvalidICalendarDataError
@@ -52,7 +53,10 @@
 from calendarserver.tools.tables import Table
 from calendarserver.tools.shell.directory import recordInfo
 
+log = Logger()
 
+
+
 class ListEntry(object):
     """
     Information about a C{File} as returned by C{File.list()}.
@@ -645,7 +649,7 @@
                 self.mainComponent = mainComponent
 
             except InvalidICalendarDataError, e:
-                log.err("%s: %s" % (self.path, e))
+                log.error("%s: %s" % (self.path, e))
 
                 self.componentType = "?"
                 self.summary = "** Invalid data **"

Modified: CalendarServer/trunk/calendarserver/tools/upgrade.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/upgrade.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/calendarserver/tools/upgrade.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -34,7 +34,7 @@
 from twisted.application.service import Service
 
 
-from twext.python.log import setLogLevelForNamespace
+from twext.python.log import LogLevel, setLogLevelForNamespace
 from calendarserver.tap.caldav import CalDAVServiceMaker
 
 def usage(e=None):
@@ -199,7 +199,7 @@
         output.flush()
 
     if not options["status"]:
-        setLogLevelForNamespace(None, "debug")
+        setLogLevelForNamespace(None, LogLevel.debug)
         log.addObserver(onlyUpgradeEvents)
 
 

Modified: CalendarServer/trunk/twext/internet/sendfdport.py
===================================================================
--- CalendarServer/trunk/twext/internet/sendfdport.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/internet/sendfdport.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -25,15 +25,18 @@
 from socket import (socketpair, fromfd, error as SocketError, AF_UNIX,
                     SOCK_STREAM, SOCK_DGRAM)
 
-from twisted.python import log
-
 from twisted.internet.abstract import FileDescriptor
 from twisted.internet.protocol import Protocol, Factory
 
+from twext.python.log import Logger
 from twext.python.sendmsg import sendmsg, recvmsg
 from twext.python.sendfd import sendfd, recvfd
 from twext.python.sendmsg import getsockfam
 
+log = Logger()
+
+
+
 class InheritingProtocol(Protocol, object):
     """
     When a connection comes in on this protocol, stop reading and writing, and
@@ -295,7 +298,7 @@
                                                   description, protocol)
                 protocol.makeConnection(transport)
             except:
-                log.err()
+                log.failure()
 
 
     def doWrite(self):

Modified: CalendarServer/trunk/twext/internet/tcp.py
===================================================================
--- CalendarServer/trunk/twext/internet/tcp.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/internet/tcp.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -78,7 +78,7 @@
         return self.socket
 
     def startListening(self):
-        log.msg("%s starting on %s" % (self.factory.__class__, self._realPortNumber))
+        log.info("%s starting on %s" % (self.factory.__class__, self._realPortNumber))
         self.factory.doStart()
         self.connected = 1
         self.fileno = self.socket.fileno

Modified: CalendarServer/trunk/twext/protocols/memcache.py
===================================================================
--- CalendarServer/trunk/twext/protocols/memcache.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/protocols/memcache.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -263,7 +263,7 @@
         """
         An non-existent command has been sent.
         """
-        log.err("Non-existent command sent.")
+        log.error("Non-existent command sent.")
         cmd = self._current.popleft()
         cmd.fail(NoSuchCommand())
 
@@ -272,7 +272,7 @@
         """
         An invalid input as been sent.
         """
-        log.err("Invalid input: %s" % (errText,))
+        log.error("Invalid input: %s" % (errText,))
         cmd = self._current.popleft()
         cmd.fail(ClientError(errText))
 
@@ -281,7 +281,7 @@
         """
         An error has happened server-side.
         """
-        log.err("Server error: %s" % (errText,))
+        log.error("Server error: %s" % (errText,))
         cmd = self._current.popleft()
         cmd.fail(ServerError(errText))
 

Modified: CalendarServer/trunk/twext/python/log.py
===================================================================
--- CalendarServer/trunk/twext/python/log.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/python/log.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -29,7 +29,7 @@
 
     from twext.python.log import LoggingMixIn
 
-    class Foo (LoggingMixIn):
+    class Foo(LoggingMixIn):
         def oops(self):
             self.log_error("Oops!")
 
@@ -44,10 +44,20 @@
 second example, it would be C{some.module.Foo}.
 """
 
+#
+# TODO List:
+#
+# * Add methods for handling failures, exceptions
+#
+# * TwistedCompatibleLogger.err is setting isError=0 until we fix our callers
+#
+# * Get rid of LoggingMixIn
+#
+# * Replace method argument with format argument
+#
+
 __all__ = [
-    "logLevels",
-    "cmpLogLevels",
-    "pythonLogLevelForLevel",
+    "LogLevel",
     "logLevelForNamespace",
     "setLogLevelForNamespace",
     "clearLogLevels",
@@ -63,6 +73,7 @@
 import inspect
 import logging
 
+from twisted.python.constants import NamedConstant, Names
 from twisted.python.failure import Failure
 from twisted.python.reflect import safe_str
 from twisted.python.log import msg as twistedLogMessage
@@ -70,63 +81,34 @@
 
 
 
-logLevels = (
-    "debug",
-    "info",
-    "warn",
-    "error",
-)
+class LogLevel(Names):
+    debug = NamedConstant()
+    info  = NamedConstant()
+    warn  = NamedConstant()
+    error = NamedConstant()
 
+    @classmethod
+    def levelWithName(cls, name):
+        try:
+            return cls.lookupByName(name)
+        except ValueError:
+            raise InvalidLogLevelError(name)
 
-logLevelIndexes = dict(zip(logLevels, xrange(0, len(logLevels))))
 
 
-def cmpLogLevels(a, b):
-    """
-    Compare two log levels.
-    @param a: a log level
-    @param b: a log level
-    @return: a negative integer if C{a < b}, C{0} if C{a == b}, or a
-        positive integer if C{a > b}.
-    """
-    return cmp(logLevelIndexes[a], logLevelIndexes[b])
-
-
-
 #
 # Mappings to Python's logging module
 #
 pythonLogLevelMapping = {
-    "debug"   : logging.DEBUG,
-    "info"    : logging.INFO,
-    "warn"    : logging.WARNING,
-    "error"   : logging.ERROR,
-   #"critical": logging.CRITICAL,
+    LogLevel.debug   : logging.DEBUG,
+    LogLevel.info    : logging.INFO,
+    LogLevel.warn    : logging.WARNING,
+    LogLevel.error   : logging.ERROR,
+   #LogLevel.critical: logging.CRITICAL,
 }
 
 
-def pythonLogLevelForLevel(level):
-    """
-    @param: a log level
-    @return: a L{logging} module log level
-    """
-    if level in pythonLogLevelMapping:
-        return pythonLogLevelMapping[level]
 
-    raise InvalidLogLevelError(level)
-
-#    #
-#    # In case we add log levels that don't map to python logging levels:
-#    #
-#    for l in logLevels:
-#        print("Trying %s: %s, %s" % (l, l in pythonLogLevelMapping, cmpLogLevels(level, l) <= 0))
-#        if l in pythonLogLevelMapping and cmpLogLevels(level, l) <= 0:
-#            return pythonLogLevelMapping[l]
-#
-#    return logging.CRITICAL
-
-
-
 ##
 # Tools for managing log levels
 ##
@@ -161,7 +143,7 @@
     @param namespace: a logging namespace
     @param level: the log level for the given namespace.
     """
-    if level not in logLevels:
+    if level not in LogLevel.iterconstants():
         raise InvalidLogLevelError(level)
 
     if namespace:
@@ -175,7 +157,7 @@
     Clears all log levels to the default.
     """
     logLevelsByNamespace.clear()
-    logLevelsByNamespace[None] = "warn"  # Default log level
+    logLevelsByNamespace[None] = LogLevel.warn  # Default log level
 
 
 logLevelsByNamespace = {}
@@ -187,7 +169,7 @@
 # Loggers
 ##
 
-class Logger (object):
+class Logger(object):
     """
     Logging object.
     """
@@ -216,23 +198,28 @@
         """
         Called internally to emit log messages at a given log level.
         """
-        assert level in logLevels, "Unknown log level: %r" % (level,)
+        assert level in LogLevel.iterconstants(), "Unknown log level: %r" % (level,)
 
-        logLevel = pythonLogLevelForLevel(level)
-
         # FIXME: Filtering should be done by the log observer(s)
         if not self.willLogAtLevel(level):
             return
 
         kwargs["level"] = level
-        kwargs["logLevel"] = logLevel
+        kwargs["levelName"] = level.name
         kwargs["namespace"] = self.namespace
 
+        #
+        # Twisted's logging supports indicating a python log level, so let's
+        # use the equivalent to our logging level.
+        #
+        if level in pythonLogLevelMapping:
+            kwargs["logLevel"] = pythonLogLevelMapping[level]
+
         if message:
             kwargs["legacyMessage"] = message
             kwargs["format"] = "%(legacyMessage)s"
 
-        prefix = "[%(namespace)s#%(level)s] "
+        prefix = "[%(namespace)s#%(levelName)s] "
 
         if "failure" in kwargs:
             # Handle unfortunate logic in twisted.log.textFromEventDict()
@@ -248,6 +235,16 @@
         twistedLogMessage(**kwargs)
 
 
+    def failure(self, failure=None, **kwargs):
+        """
+        Log a Failure.
+        """
+        if failure is None:
+            failure=Failure()
+
+        self.emit(LogLevel.error, failure=failure, isError=1, **kwargs)
+
+
     def level(self):
         """
         @return: the logging level for this logger's namespace.
@@ -269,15 +266,17 @@
         @return: C{True} if this logger will log at the given logging
             level.
         """
-        return cmpLogLevels(self.level(), level) <= 0
+        return self.level() <= level
 
 
+
+class TwistedCompatibleLogger(Logger):
     def msg(self, *message, **kwargs):
         if message:
             message = " ".join(map(safe_str, message))
         else:
             message = None
-        return self.emit("info", message, **kwargs)
+        return self.emit(LogLevel.info, message, **kwargs)
 
 
     def err(self, _stuff=None, _why=None, **kwargs):
@@ -290,14 +289,14 @@
         # existing bugs, should be =1.
 
         if isinstance(_stuff, Failure):
-            self.emit("error", failure=_stuff, why=_why, isError=0, **kwargs)
+            self.emit(LogLevel.error, failure=_stuff, why=_why, isError=0, **kwargs)
         else:
             # We got called with an invalid _stuff.
-            self.emit("error", repr(_stuff), why=_why, isError=0, **kwargs)
+            self.emit(LogLevel.error, repr(_stuff), why=_why, isError=0, **kwargs)
 
 
 
-class LoggingMixIn (object):
+class LoggingMixIn(object):
     """
     Mix-in class for logging methods.
     """
@@ -331,7 +330,7 @@
     #
     # Attach methods to Logger
     #
-    def log_emit(self, message, raiseException=None, **kwargs):
+    def log_emit(self, message=None, raiseException=None, **kwargs):
         self.emit(level, message, **kwargs)
         if raiseException:
             raise raiseException(message)
@@ -341,13 +340,13 @@
 
     log_emit.__doc__ = doc
 
-    setattr(Logger, level, log_emit)
-    setattr(Logger, level + "_enabled", property(will_emit))
+    setattr(Logger, level.name, log_emit)
+    setattr(Logger, level.name + "_enabled", property(will_emit))
 
     #
     # Attach methods to LoggingMixIn
     #
-    def log_emit(self, message, raiseException=None, **kwargs):
+    def log_emit(self, message=None, raiseException=None, **kwargs):
         self.logger.emit(level, message, **kwargs)
         if raiseException:
             raise raiseException(message)
@@ -358,11 +357,11 @@
     log_emit.__doc__ = doc
     log_emit.enabled = will_emit
 
-    setattr(LoggingMixIn, "log_" + level, log_emit)
-    setattr(LoggingMixIn, "log_" + level + "_enabled", property(will_emit))
+    setattr(LoggingMixIn, "log_" + level.name, log_emit)
+    setattr(LoggingMixIn, "log_" + level.name + "_enabled", property(will_emit))
 
 
-for level in logLevels: 
+for level in LogLevel.iterconstants(): 
     bindEmit(level)
 del level
 
@@ -371,7 +370,7 @@
 # Errors
 ##
 
-class InvalidLogLevelError (RuntimeError):
+class InvalidLogLevelError(RuntimeError):
     def __init__(self, level):
         super(InvalidLogLevelError, self).__init__(str(level))
         self.level = level
@@ -382,7 +381,7 @@
 # Observers
 ##
 
-class StandardIOObserver (object):
+class StandardIOObserver(object):
     """
     Log observer that writes to standard I/O.
     """

Modified: CalendarServer/trunk/twext/python/test/test_log.py
===================================================================
--- CalendarServer/trunk/twext/python/test/test_log.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/python/test/test_log.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -19,20 +19,23 @@
 from twisted.python import log as twistedLogging
 
 from twext.python.log import logLevelsByNamespace, logLevelForNamespace
-from twext.python.log import setLogLevelForNamespace, clearLogLevels
-from twext.python.log import logLevels, cmpLogLevels
-from twext.python.log import pythonLogLevelForLevel, InvalidLogLevelError
+from twext.python.log import LogLevel, setLogLevelForNamespace, clearLogLevels
+from twext.python.log import pythonLogLevelMapping
 from twext.python.log import Logger, LoggingMixIn
 
 from twistedcaldav.test.util import TestCase
 
+
+
 defaultLogLevel = logLevelsByNamespace[None]
 
 
+
 class TestLogger (Logger):
     def __init__(self, namespace=None):
         super(TestLogger, self).__init__(namespace)
 
+
     def emit(self, level, message, **kwargs):
         def observer(eventDict):
             self.eventDict = eventDict
@@ -49,31 +52,24 @@
             "kwargs" : kwargs,
         }
 
+
+
 class LoggingEnabledObject (LoggingMixIn):
     pass
 
+
+
 class Logging (TestCase):
     def setUp(self):
         super(Logging, self).setUp()
         clearLogLevels()
 
+
     def tearDown(self):
         super(Logging, self).tearDown()
         clearLogLevels()
 
-    def test_cmpLogLevels(self):
-        self.assertEquals(cmpLogLevels("info" , "error"), -1)
-        self.assertEquals(cmpLogLevels("debug", "debug"),  0)
-        self.assertEquals(cmpLogLevels("warn" , "debug"),  1)
 
-    def test_pythonLogLevel(self):
-        self.assertEquals(pythonLogLevelForLevel("debug"), logging.DEBUG)
-        self.assertEquals(pythonLogLevelForLevel("info"), logging.INFO)
-        self.assertEquals(pythonLogLevelForLevel("warn"), logging.WARNING)
-        self.assertEquals(pythonLogLevelForLevel("error"), logging.ERROR)
-        #self.assertEquals(pythonLogLevelForLevel("critical"), logging.CRITICAL)
-        self.assertRaises(InvalidLogLevelError, pythonLogLevelForLevel, "-not-a-log-level-")
-
     def test_namespace_default(self):
         """
         Default namespace is module name.
@@ -81,6 +77,7 @@
         log = Logger()
         self.assertEquals(log.namespace, __name__)
 
+
     def test_namespace_mixin(self):
         """
         Default namespace for classes using L{LoggingMixIn} is the class name.
@@ -88,16 +85,17 @@
         object = LoggingEnabledObject()
         self.assertEquals(object.logger.namespace, "twext.python.test.test_log.LoggingEnabledObject")
 
+
     def test_basic_Logger(self):
         """
         Test that log levels and messages are emitted correctly for
         Logger.
         """
-        for level in logLevels:
-            message = "This is a %s message" % (level,)
+        for level in LogLevel.iterconstants():
+            message = "This is a %s message" % (level.name,)
 
             log = TestLogger()
-            method = getattr(log, level)
+            method = getattr(log, level.name)
             method(message, junk=message)
 
             # Ensure that test_emit got called with expected arguments
@@ -107,7 +105,7 @@
 
             if log.willLogAtLevel(level):
                 self.assertEquals(log.eventDict["level"], level)
-                self.assertEquals(log.eventDict["logLevel"], pythonLogLevelForLevel(level))
+                self.assertEquals(log.eventDict["logLevel"], pythonLogLevelMapping[level])
                 self.assertEquals(log.eventDict["junk"], message)
 
                 # FIXME: this checks the end of message because we do formatting in emit()
@@ -118,18 +116,19 @@
             else:
                 self.assertFalse(hasattr(log, "eventDict"))
 
+
     def test_basic_LoggingMixIn(self):
         """
         Test that log levels and messages are emitted correctly for
         LoggingMixIn.
         """
-        for level in logLevels:
-            message = "This is a %s message" % (level,)
+        for level in LogLevel.iterconstants():
+            message = "This is a %s message" % (level.name,)
 
             object = LoggingEnabledObject()
             object.logger = TestLogger()
 
-            method = getattr(object, "log_" + level)
+            method = getattr(object, "log_" + level.name)
             method(message, junk=message)
 
             # Ensure that test_emit got called with expected arguments
@@ -139,7 +138,7 @@
 
             if object.logger.willLogAtLevel(level):
                 self.assertEquals(object.logger.eventDict["level"], level)
-                self.assertEquals(object.logger.eventDict["logLevel"], pythonLogLevelForLevel(level))
+                self.assertEquals(object.logger.eventDict["logLevel"], pythonLogLevelMapping[level])
                 self.assertEquals(object.logger.eventDict["junk"], message)
 
                 # FIXME: this checks the end of message because we do formatting in emit()
@@ -150,6 +149,7 @@
             else:
                 self.assertFalse(hasattr(object.logger, "eventDict"))
 
+
     def test_conflicting_kwargs(self):
         """
         Make sure that conflicting kwargs don't pass through.
@@ -160,52 +160,57 @@
         self.assertEquals(log.eventDict["logLevel"], logging.ERROR)
         self.assertEquals(log.eventDict["namespace"], log.namespace)
 
+
     def test_defaultLogLevel(self):
         """
         Default log level is used.
         """
         self.failUnless(logLevelForNamespace("rocker.cool.namespace"), defaultLogLevel)
 
+
     def test_logLevel(self):
         """
         Setting and retrieving log levels.
         """
-        setLogLevelForNamespace("twext.web2", "debug")
-        setLogLevelForNamespace("twext.web2.dav", "error")
+        setLogLevelForNamespace("twext.web2", LogLevel.debug)
+        setLogLevelForNamespace("twext.web2.dav", LogLevel.error)
 
-        self.assertEquals(logLevelForNamespace("twisted"                     ), defaultLogLevel)
-        self.assertEquals(logLevelForNamespace("twext.web2"                ), "debug")
-        self.assertEquals(logLevelForNamespace("twext.web2.dav"            ), "error")
-        self.assertEquals(logLevelForNamespace("twext.web2.dav.test"       ), "error")
-        self.assertEquals(logLevelForNamespace("twext.web2.dav.test1.test2"), "error")
+        self.assertEquals(logLevelForNamespace("twisted"                   ), defaultLogLevel)
+        self.assertEquals(logLevelForNamespace("twext.web2"                ), LogLevel.debug)
+        self.assertEquals(logLevelForNamespace("twext.web2.dav"            ), LogLevel.error)
+        self.assertEquals(logLevelForNamespace("twext.web2.dav.test"       ), LogLevel.error)
+        self.assertEquals(logLevelForNamespace("twext.web2.dav.test1.test2"), LogLevel.error)
 
+
     def test_clearLogLevel(self):
         """
         Clearing log levels.
         """
-        setLogLevelForNamespace("twext.web2", "debug")
-        setLogLevelForNamespace("twext.web2.dav", "error")
+        setLogLevelForNamespace("twext.web2", LogLevel.debug)
+        setLogLevelForNamespace("twext.web2.dav", LogLevel.error)
 
         clearLogLevels()
 
-        self.assertEquals(logLevelForNamespace("twisted"                     ), defaultLogLevel)
+        self.assertEquals(logLevelForNamespace("twisted"                   ), defaultLogLevel)
         self.assertEquals(logLevelForNamespace("twext.web2"                ), defaultLogLevel)
         self.assertEquals(logLevelForNamespace("twext.web2.dav"            ), defaultLogLevel)
         self.assertEquals(logLevelForNamespace("twext.web2.dav.test"       ), defaultLogLevel)
         self.assertEquals(logLevelForNamespace("twext.web2.dav.test1.test2"), defaultLogLevel)
 
+
     def test_willLogAtLevel(self):
         """
         willLogAtLevel()
         """
         log = Logger()
 
-        for level in logLevels:
-            if cmpLogLevels(level, log.level()) < 0:
-                self.assertFalse(log.willLogAtLevel(level))
+        for level in LogLevel.iterconstants():
+            if level < log.level():
+                self.assertFalse(log.willLogAtLevel(level), (level, log.level()))
             else:
-                self.assertTrue(log.willLogAtLevel(level))
+                self.assertTrue(log.willLogAtLevel(level), (level, log.level()))
 
+
     def test_logMethodTruthiness_Logger(self):
         """
         Logger's log level functions/methods have true/false
@@ -213,13 +218,14 @@
         """
         log = Logger()
 
-        for level in logLevels:
-            enabled = getattr(log, level + "_enabled")
+        for level in LogLevel.iterconstants():
+            enabled = getattr(log, level.name + "_enabled")
             if enabled:
                 self.assertTrue(log.willLogAtLevel(level))
             else:
                 self.assertFalse(log.willLogAtLevel(level))
 
+
     def test_logMethodTruthiness_LoggingMixIn(self):
         """
         LoggingMixIn's log level functions/methods have true/false
@@ -227,8 +233,8 @@
         """
         object = LoggingEnabledObject()
 
-        for level in logLevels:
-            enabled = getattr(object, "log_" + level + "_enabled")
+        for level in LogLevel.iterconstants():
+            enabled = getattr(object, "log_" + level.name + "_enabled")
             if enabled:
                 self.assertTrue(object.logger.willLogAtLevel(level))
             else:

Modified: CalendarServer/trunk/twext/web2/channel/http.py
===================================================================
--- CalendarServer/trunk/twext/web2/channel/http.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/channel/http.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -54,7 +54,7 @@
         self.outstandingRequests = outstandingRequests
 
     def connectionMade(self):
-        log.msg(overloaded=self)
+        log.info(overloaded=self)
 
         self.transport.write(
             "HTTP/1.0 503 Service Unavailable\r\n"
@@ -636,7 +636,7 @@
     def _cleanup(self):
         """Called when have finished responding and are no longer queued."""
         if self.producer:
-            log.err(RuntimeError("Producer was not unregistered for %s" % self))
+            log.error(RuntimeError("Producer was not unregistered for %s" % self))
             self.unregisterProducer()
         self.channel.requestWriteFinished(self)
         del self.transport
@@ -884,7 +884,7 @@
             self.lingeringClose()
 
     def timeoutConnection(self):
-        #log.msg("Timing out client: %s" % str(self.transport.getPeer()))
+        #log.info("Timing out client: %s" % str(self.transport.getPeer()))
         policies.TimeoutMixin.timeoutConnection(self)
 
     def lingeringClose(self):

Modified: CalendarServer/trunk/twext/web2/dav/fileop.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/fileop.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/fileop.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -91,7 +91,7 @@
 
         if depth != "infinity":
             msg = ("Client sent illegal depth header value for DELETE: %s" % (depth,))
-            log.err(msg)
+            log.error(msg)
             raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, msg))
 
         #
@@ -111,7 +111,7 @@
         if uri_path[-1] == "/":
             uri_path = uri_path[:-1]
 
-        log.msg("Deleting directory %s" % (filepath.path,))
+        log.info("Deleting directory %s" % (filepath.path,))
 
         # NOTE: len(uri_path) is wrong if os.sep is not one byte long... meh.
         request_basename = filepath.path[:-len(uri_path)]
@@ -154,7 +154,7 @@
         #
         # Delete a file; much simpler, eh?
         #
-        log.msg("Deleting file %s" % (filepath.path,))
+        log.info("Deleting file %s" % (filepath.path,))
         try:
             os.remove(filepath.path)
         except:
@@ -194,7 +194,7 @@
         #
         # Copy the file
         #
-        log.msg("Copying file %s to %s" % (source_filepath.path, destination_filepath.path))
+        log.info("Copying file %s to %s" % (source_filepath.path, destination_filepath.path))
 
         try:
             source_file = source_filepath.open()
@@ -232,7 +232,7 @@
         #
         # Copy the directory
         #
-        log.msg("Copying directory %s to %s" % (source_filepath.path, destination_filepath.path))
+        log.info("Copying directory %s to %s" % (source_filepath.path, destination_filepath.path))
 
         source_basename = source_filepath.path
         destination_basename = destination_filepath.path
@@ -295,7 +295,7 @@
 
             for subdir in subdirs:
                 source_path, destination_path = paths(dir, subdir)
-                log.msg("Copying directory %s to %s" % (source_path, destination_path))
+                log.info("Copying directory %s to %s" % (source_path, destination_path))
 
                 if not os.path.isdir(os.path.dirname(destination_path)):
                     errors.add(source_path, responsecode.CONFLICT)
@@ -317,7 +317,7 @@
         yield errors.response()
         return
     else:
-        log.err("Unable to COPY to non-file: %s" % (source_filepath.path,))
+        log.error("Unable to COPY to non-file: %s" % (source_filepath.path,))
         raise HTTPError(StatusResponse(
             responsecode.FORBIDDEN,
             "The requested resource exists but is not backed by a regular file."
@@ -348,7 +348,7 @@
         if the destination already exists, or L{responsecode.NO_CONTENT} if the
         destination was created by the X{MOVE} operation.
     """
-    log.msg("Moving %s to %s" % (source_filepath.path, destination_filepath.path))
+    log.info("Moving %s to %s" % (source_filepath.path, destination_filepath.path))
 
     #
     # Choose a success status
@@ -419,7 +419,7 @@
         if the destination already exists, or L{responsecode.NO_CONTENT} if the
         destination was created by the X{PUT} operation.
     """
-    log.msg("Writing to file %s" % (filepath.path,))
+    log.info("Writing to file %s" % (filepath.path,))
 
     if filepath.exists():
         if uri is None:

Modified: CalendarServer/trunk/twext/web2/dav/http.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/http.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/http.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -174,7 +174,7 @@
             raise AssertionError("Unknown data type: %r" % (what,))
 
         if code > 400: # Error codes only
-            log.err("Error during %s for %s: %s" % (self.method, path, message))
+            log.error("Error during %s for %s: %s" % (self.method, path, message))
 
         uri = path[self.path_basename_len:]
 
@@ -238,7 +238,7 @@
             property = element.WebDAVUnknownElement.withName(property.namespace, property.name)
 
         if code > 400: # Error codes only
-            log.err("Error during %s for %s: %s" % (self.method, property, message))
+            log.error("Error during %s for %s: %s" % (self.method, property, message))
 
         children = []
         children.append(element.PropertyContainer(property))

Modified: CalendarServer/trunk/twext/web2/dav/method/acl.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/acl.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/acl.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -46,7 +46,7 @@
     Respond to a ACL request. (RFC 3744, section 8.1)
     """
     if not self.exists():
-        log.err("File not found: %s" % (self,))
+        log.error("File not found: %s" % (self,))
         yield responsecode.NOT_FOUND
         return
 
@@ -65,7 +65,7 @@
     try:
         doc = doc.getResult()
     except ValueError, e:
-        log.err("Error while handling ACL body: %s" % (e,))
+        log.error("Error while handling ACL body: %s" % (e,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, str(e)))
 
     #
@@ -73,7 +73,7 @@
     #
     if doc is None:
         error = "Request XML body is required."
-        log.err(error)
+        log.error(error)
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
 
     #
@@ -83,7 +83,7 @@
     if not isinstance(acl, davxml.ACL):
         error = ("Request XML body must be an acl element."
                  % (davxml.PropertyUpdate.sname(),))
-        log.err(error)
+        log.error(error)
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
 
     #

Modified: CalendarServer/trunk/twext/web2/dav/method/copymove.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/copymove.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/copymove.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -154,7 +154,7 @@
     #
     if self.isCollection() and depth != "infinity":
         msg = "Client sent illegal depth header value for MOVE: %s" % (depth,)
-        log.err(msg)
+        log.error(msg)
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, msg))
 
     # Lets optimise a move within the same directory to a new resource as a simple move
@@ -184,7 +184,7 @@
 
     if depth not in ("0", "infinity"):
         msg = ("Client sent illegal depth header value: %s" % (depth,))
-        log.err(msg)
+        log.error(msg)
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, msg))
 
     #
@@ -192,7 +192,7 @@
     #
 
     if not self.exists():
-        log.err("File not found: %s" % (self,))
+        log.error("File not found: %s" % (self,))
         raise HTTPError(StatusResponse(
             responsecode.NOT_FOUND,
             "Source resource %s not found." % (request.uri,)
@@ -206,7 +206,7 @@
 
     if not destination_uri:
         msg = "No destination header in %s request." % (request.method,)
-        log.err(msg)
+        log.error(msg)
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, msg))
 
     d = request.locateResource(destination_uri)
@@ -222,8 +222,8 @@
     try:
         destination = IDAVResource(destination)
     except TypeError:
-        log.err("Attempt to %s to a non-DAV resource: (%s) %s"
-                % (request.method, destination.__class__, destination_uri))
+        log.error("Attempt to %s to a non-DAV resource: (%s) %s"
+                  % (request.method, destination.__class__, destination_uri))
         raise HTTPError(StatusResponse(
             responsecode.FORBIDDEN,
             "Destination %s is not a WebDAV resource." % (destination_uri,)
@@ -236,7 +236,7 @@
     #
 
     if not isinstance(destination, twext.web2.dav.static.DAVFile):
-        log.err("DAV copy between non-DAVFile DAV resources isn't implemented")
+        log.error("DAV copy between non-DAVFile DAV resources isn't implemented")
         raise HTTPError(StatusResponse(
             responsecode.NOT_IMPLEMENTED,
             "Destination %s is not a DAVFile resource." % (destination_uri,)
@@ -249,8 +249,8 @@
     overwrite = request.headers.getHeader("overwrite", True)
 
     if destination.exists() and not overwrite:
-        log.err("Attempt to %s onto existing file without overwrite flag enabled: %s"
-                % (request.method, destination))
+        log.error("Attempt to %s onto existing file without overwrite flag enabled: %s"
+                  % (request.method, destination))
         raise HTTPError(StatusResponse(
             responsecode.PRECONDITION_FAILED,
             "Destination %s already exists." % (destination_uri,)
@@ -261,8 +261,8 @@
     #
 
     if not destination.parent().isCollection():
-        log.err("Attempt to %s to a resource with no parent: %s"
-                % (request.method, destination.fp.path))
+        log.error("Attempt to %s to a resource with no parent: %s"
+                  % (request.method, destination.fp.path))
         raise HTTPError(StatusResponse(responsecode.CONFLICT, "No parent collection."))
 
     return destination, destination_uri, depth

Modified: CalendarServer/trunk/twext/web2/dav/method/delete.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/delete.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/delete.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -46,7 +46,7 @@
     Respond to a DELETE request. (RFC 2518, section 8.6)
     """
     if not self.exists():
-        log.err("File not found: %s" % (self,))
+        log.error("File not found: %s" % (self,))
         raise HTTPError(responsecode.NOT_FOUND)
 
     depth = request.headers.getHeader("depth", "infinity")

Modified: CalendarServer/trunk/twext/web2/dav/method/delete_common.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/delete_common.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/delete_common.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -42,7 +42,7 @@
     Handle a resource delete with proper quota etc updates
     """
     if not resource.exists():
-        log.err("File not found: %s" % (resource,))
+        log.error("File not found: %s" % (resource,))
         raise HTTPError(responsecode.NOT_FOUND)
 
     # Do quota checks before we start deleting things

Modified: CalendarServer/trunk/twext/web2/dav/method/mkcol.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/mkcol.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/mkcol.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -54,13 +54,13 @@
     x.getResult()
 
     if self.exists():
-        log.err("Attempt to create collection where file exists: %s"
-                % (self,))
+        log.error("Attempt to create collection where file exists: %s"
+                  % (self,))
         raise HTTPError(responsecode.NOT_ALLOWED)
 
     if not parent.isCollection():
-        log.err("Attempt to create collection with non-collection parent: %s"
-                % (self,))
+        log.error("Attempt to create collection with non-collection parent: %s"
+                  % (self,))
         raise HTTPError(StatusResponse(
             responsecode.CONFLICT,
             "Parent resource is not a collection."
@@ -74,7 +74,7 @@
     try:
         x.getResult()
     except ValueError, e:
-        log.err("Error while handling MKCOL body: %s" % (e,))
+        log.error("Error while handling MKCOL body: %s" % (e,))
         raise HTTPError(responsecode.UNSUPPORTED_MEDIA_TYPE)
 
     response = waitForDeferred(mkcollection(self.fp))

Modified: CalendarServer/trunk/twext/web2/dav/method/prop_common.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/prop_common.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/prop_common.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -94,8 +94,8 @@
                 f = Failure()
                 status = statusForFailure(f, "getting property: %s" % (qname,))
                 if status != responsecode.NOT_FOUND:
-                    log.err("Error reading property %r for resource %s: %s" %
-                            (qname, request.uri, f.value))
+                    log.error("Error reading property %r for resource %s: %s" %
+                              (qname, request.uri, f.value))
                 if status not in properties_by_status: properties_by_status[status] = []
                 properties_by_status[status].append(propertyName(qname))
         else:

Modified: CalendarServer/trunk/twext/web2/dav/method/propfind.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/propfind.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/propfind.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -52,7 +52,7 @@
     Respond to a PROPFIND request. (RFC 2518, section 8.1)
     """
     if not self.exists():
-        log.err("File not found: %s" % (self,))
+        log.error("File not found: %s" % (self,))
         raise HTTPError(responsecode.NOT_FOUND)
 
     #
@@ -70,7 +70,7 @@
         yield doc
         doc = doc.getResult()
     except ValueError, e:
-        log.err("Error while handling PROPFIND body: %s" % (e,))
+        log.error("Error while handling PROPFIND body: %s" % (e,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, str(e)))
 
     if doc is None:
@@ -84,7 +84,7 @@
         if not isinstance(find, davxml.PropertyFind):
             error = ("Non-%s element in PROPFIND request body: %s"
                      % (davxml.PropertyFind.sname(), find))
-            log.err(error)
+            log.error(error)
             raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
 
         container = find.children[0]
@@ -151,7 +151,7 @@
                 yield resource_properties
                 resource_properties = resource_properties.getResult()
             except:
-                log.err("Unable to get properties for resource %r" % (resource,))
+                log.error("Unable to get properties for resource %r" % (resource,))
                 raise
 
             properties_by_status = {

Modified: CalendarServer/trunk/twext/web2/dav/method/proppatch.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/proppatch.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/proppatch.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -47,7 +47,7 @@
     Respond to a PROPPATCH request. (RFC 2518, section 8.2)
     """
     if not self.exists():
-        log.err("File not found: %s" % (self,))
+        log.error("File not found: %s" % (self,))
         raise HTTPError(responsecode.NOT_FOUND)
 
     x = waitForDeferred(self.authorize(request, (davxml.WriteProperties(),)))
@@ -62,12 +62,12 @@
         yield doc
         doc = doc.getResult()
     except ValueError, e:
-        log.err("Error while handling PROPPATCH body: %s" % (e,))
+        log.error("Error while handling PROPPATCH body: %s" % (e,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, str(e)))
 
     if doc is None:
         error = "Request XML body is required."
-        log.err(error)
+        log.error(error)
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
 
     #
@@ -77,7 +77,7 @@
     if not isinstance(update, davxml.PropertyUpdate):
         error = ("Request XML body must be a propertyupdate element."
                  % (davxml.PropertyUpdate.sname(),))
-        log.err(error)
+        log.error(error)
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
 
     responses = PropertyStatusResponseQueue("PROPPATCH", request.uri, responsecode.NO_CONTENT)

Modified: CalendarServer/trunk/twext/web2/dav/method/put.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/put.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/put.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -80,8 +80,8 @@
            #"Content-Range",    # FIXME: Need to implement this
             "Content-Type",
         ):
-            log.err("Client sent unrecognized content header in PUT request: %s"
-                    % (header,))
+            log.error("Client sent unrecognized content header in PUT request: %s"
+                      % (header,))
             raise HTTPError(StatusResponse(
                 responsecode.NOT_IMPLEMENTED,
                 "Unrecognized content header %r in request." % (header,)
@@ -93,7 +93,7 @@
     """
     Respond to a PUT request. (RFC 2518, section 8.7)
     """
-    log.msg("Writing request stream to %s" % (self,))
+    log.info("Writing request stream to %s" % (self,))
 
     #
     # Don't pass in the request URI, since PUT isn't specified to be able

Modified: CalendarServer/trunk/twext/web2/dav/method/put_common.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/put_common.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/put_common.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -24,12 +24,12 @@
 
 __all__ = ["storeResource"]
 
+from twisted.python.failure import Failure
+from twext.python.filepath import CachingFilePath as FilePath
 from twisted.internet.defer import deferredGenerator, maybeDeferred, waitForDeferred
-from twisted.python import failure, log
-from twext.python.filepath import CachingFilePath as FilePath
+
+from twext.python.log import Logger
 from twext.web2 import responsecode
-from txdav.xml import element as davxml
-from txdav.xml.base import dav_namespace
 from twext.web2.dav.fileop import copy, delete, put
 from twext.web2.dav.http import ErrorResponse
 from twext.web2.dav.resource import TwistedGETContentMD5
@@ -39,6 +39,13 @@
 from twext.web2.iweb import IResponse
 from twext.web2.stream import MemoryStream
 
+from txdav.xml import element as davxml
+from txdav.xml.base import dav_namespace
+
+log = Logger()
+
+
+
 def storeResource(
     request,
     source=None, source_uri=None, data=None,
@@ -66,15 +73,15 @@
         assert (source is None) or (source is not None and source_uri is not None)
         assert not deletesource or (deletesource and source is not None)
     except AssertionError:
-        log.err("Invalid arguments to storeResource():")
-        log.err("request=%s\n" % (request,))
-        log.err("source=%s\n" % (source,))
-        log.err("source_uri=%s\n" % (source_uri,))
-        log.err("data=%s\n" % (data,))
-        log.err("destination=%s\n" % (destination,))
-        log.err("destination_uri=%s\n" % (destination_uri,))
-        log.err("deletesource=%s\n" % (deletesource,))
-        log.err("depth=%s\n" % (depth,))
+        log.error("Invalid arguments to storeResource():")
+        log.error("request=%s\n" % (request,))
+        log.error("source=%s\n" % (source,))
+        log.error("source_uri=%s\n" % (source_uri,))
+        log.error("data=%s\n" % (data,))
+        log.error("destination=%s\n" % (destination,))
+        log.error("destination_uri=%s\n" % (destination_uri,))
+        log.error("deletesource=%s\n" % (deletesource,))
+        log.error("depth=%s\n" % (depth,))
         raise
 
     class RollbackState(object):
@@ -99,39 +106,39 @@
             """
             if self.active:
                 self.active = False
-                log.err("Rollback: rollback")
+                log.error("Rollback: rollback")
                 try:
                     if self.source_copy and self.source_deleted:
                         self.source_copy.moveTo(source.fp)
-                        log.err("Rollback: source restored %s to %s" % (self.source_copy.path, source.fp.path))
+                        log.error("Rollback: source restored %s to %s" % (self.source_copy.path, source.fp.path))
                         self.source_copy = None
                         self.source_deleted = False
                     if self.destination_copy:
                         destination.fp.remove()
-                        log.err("Rollback: destination restored %s to %s" % (self.destination_copy.path, destination.fp.path))
+                        log.error("Rollback: destination restored %s to %s" % (self.destination_copy.path, destination.fp.path))
                         self.destination_copy.moveTo(destination.fp)
                         self.destination_copy = None
                     elif self.destination_created:
                         destination.fp.remove()
-                        log.err("Rollback: destination removed %s" % (destination.fp.path,))
+                        log.error("Rollback: destination removed %s" % (destination.fp.path,))
                         self.destination_created = False
                 except:
-                    log.err("Rollback: exception caught and not handled: %s" % failure.Failure())
+                    log.error("Rollback: exception caught and not handled: %s" % Failure())
 
         def Commit(self):
             """
             Commit the resource changes by wiping the rollback state.
             """
             if self.active:
-                log.err("Rollback: commit")
+                log.error("Rollback: commit")
                 self.active = False
                 if self.source_copy:
                     self.source_copy.remove()
-                    log.err("Rollback: removed source backup %s" % (self.source_copy.path,))
+                    log.error("Rollback: removed source backup %s" % (self.source_copy.path,))
                     self.source_copy = None
                 if self.destination_copy:
                     self.destination_copy.remove()
-                    log.err("Rollback: removed destination backup %s" % (self.destination_copy.path,))
+                    log.error("Rollback: removed destination backup %s" % (self.destination_copy.path,))
                     self.destination_copy = None
                 self.destination_created = False
                 self.source_deleted = False
@@ -233,7 +240,7 @@
             new_dest_size = new_dest_size.getResult()
             diff_size = new_dest_size - old_dest_size
             if diff_size >= destquota[0]:
-                log.err("Over quota: available %d, need %d" % (destquota[0], diff_size))
+                log.error("Over quota: available %d, need %d" % (destquota[0], diff_size))
                 raise HTTPError(ErrorResponse(
                     responsecode.INSUFFICIENT_STORAGE_SPACE,
                     (dav_namespace, "quota-not-exceeded")

Modified: CalendarServer/trunk/twext/web2/dav/method/report.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/report.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/report.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -66,7 +66,7 @@
     Respond to a REPORT request. (RFC 3253, section 3.6)
     """
     if not self.exists():
-        log.err("File not found: %s" % (self,))
+        log.error("File not found: %s" % (self,))
         raise HTTPError(responsecode.NOT_FOUND)
 
     #
@@ -84,7 +84,7 @@
         yield doc
         doc = doc.getResult()
     except ValueError, e:
-        log.err("Error while handling REPORT body: %s" % (e,))
+        log.error("Error while handling REPORT body: %s" % (e,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, str(e)))
 
     if doc is None:
@@ -137,8 +137,8 @@
         #
         # Requested report is not supported.
         #
-        log.err("Unsupported REPORT %s for resource %s (no method %s)"
-                % (encodeXMLName(namespace, name), self, method_name))
+        log.error("Unsupported REPORT %s for resource %s (no method %s)"
+                  % (encodeXMLName(namespace, name), self, method_name))
 
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,

Modified: CalendarServer/trunk/twext/web2/dav/method/report_acl_principal_prop_set.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/report_acl_principal_prop_set.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/report_acl_principal_prop_set.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -56,7 +56,7 @@
     # Depth must be "0"
     depth = request.headers.getHeader("depth", "0")
     if depth != "0":
-        log.err("Error in prinicpal-prop-set REPORT, Depth set to %s" % (depth,))
+        log.error("Error in prinicpal-prop-set REPORT, Depth set to %s" % (depth,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,)))
     
     #
@@ -72,7 +72,7 @@
     for child in acl_prinicpal_prop_set.children:
         if child.qname() == ("DAV:", "prop"):
             if propertiesForResource is not None:
-                log.err("Only one DAV:prop element allowed")
+                log.error("Only one DAV:prop element allowed")
                 raise HTTPError(StatusResponse(
                     responsecode.BAD_REQUEST,
                     "Only one DAV:prop element allowed"
@@ -81,7 +81,7 @@
             propElement = child
 
     if propertiesForResource is None:
-        log.err("Error in acl-principal-prop-set REPORT, no DAV:prop element")
+        log.error("Error in acl-principal-prop-set REPORT, no DAV:prop element")
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "No DAV:prop element"))
 
     # Enumerate principals on ACL in current resource
@@ -137,14 +137,14 @@
                     yield d
                     d.getResult()
             else:
-                log.err("Requested principal resource not found: %s" % (str(principal),))
+                log.error("Requested principal resource not found: %s" % (str(principal),))
                 responses.append(davxml.StatusResponse(
                     principal,
                     davxml.Status.fromResponseCode(responsecode.NOT_FOUND)
                 ))
 
     except NumberOfMatchesWithinLimits:
-        log.err("Too many matching components")
+        log.error("Too many matching components")
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,
             davxml.NumberOfMatchesWithinLimits()

Modified: CalendarServer/trunk/twext/web2/dav/method/report_expand.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/report_expand.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/report_expand.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -59,7 +59,7 @@
     # Only handle Depth: 0
     depth = request.headers.getHeader("depth", "0")
     if depth != "0":
-        log.err("Non-zero depth is not allowed: %s" % (depth,))
+        log.error("Non-zero depth is not allowed: %s" % (depth,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,)))
     
     #
@@ -75,7 +75,7 @@
         props_to_find = []
         for child in property.children:
             if child.children:
-                log.err("expand-property REPORT only supports single level expansion")
+                log.error("expand-property REPORT only supports single level expansion")
                 raise HTTPError(StatusResponse(
                     responsecode.NOT_IMPLEMENTED,
                     "expand-property REPORT only supports single level expansion"
@@ -155,7 +155,7 @@
         except:
             f = Failure()
 
-            log.err("Error reading property %r for resource %s: %s" % (qname, request.uri, f.value))
+            log.error("Error reading property %r for resource %s: %s" % (qname, request.uri, f.value))
 
             status = statusForFailure(f, "getting property: %s" % (qname,))
             if status not in properties_by_status: properties_by_status[status] = []

Modified: CalendarServer/trunk/twext/web2/dav/method/report_principal_match.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/report_principal_match.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/report_principal_match.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -58,7 +58,7 @@
     # Only handle Depth: 0
     depth = request.headers.getHeader("depth", "0")
     if depth != "0":
-        log.err("Non-zero depth is not allowed: %s" % (depth,))
+        log.error("Non-zero depth is not allowed: %s" % (depth,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,)))
     
     # Get a single DAV:prop element from the REPORT request body
@@ -78,8 +78,8 @@
         elif child.qname() == (dav_namespace, "principal-property"):
             # Must have one and only one property in this element
             if len(child.children) != 1:
-                log.err("Wrong number of properties in DAV:principal-property: %s"
-                        % (len(child.children),))
+                log.error("Wrong number of properties in DAV:principal-property: %s"
+                          % (len(child.children),))
                 raise HTTPError(StatusResponse(
                     responsecode.BAD_REQUEST,
                     "DAV:principal-property must contain exactly one property"
@@ -191,7 +191,7 @@
                     pass
 
     except NumberOfMatchesWithinLimits:
-        log.err("Too many matching components in principal-match report")
+        log.error("Too many matching components in principal-match report")
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,
             element.NumberOfMatchesWithinLimits()

Modified: CalendarServer/trunk/twext/web2/dav/method/report_principal_property_search.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/report_principal_property_search.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/report_principal_property_search.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -59,7 +59,7 @@
     # Only handle Depth: 0
     depth = request.headers.getHeader("depth", "0")
     if depth != "0":
-        log.err("Error in prinicpal-property-search REPORT, Depth set to %s" % (depth,))
+        log.error("Error in prinicpal-property-search REPORT, Depth set to %s" % (depth,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,)))
     
     # Get a single DAV:prop element from the REPORT request body
@@ -180,7 +180,7 @@
                         d.getResult()
 
     except NumberOfMatchesWithinLimits:
-        log.err("Too many matching components in prinicpal-property-search report")
+        log.error("Too many matching components in prinicpal-property-search report")
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,
             element.NumberOfMatchesWithinLimits()

Modified: CalendarServer/trunk/twext/web2/dav/method/report_principal_search_property_set.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/method/report_principal_search_property_set.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/method/report_principal_search_property_set.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -52,13 +52,13 @@
     # Only handle Depth: 0
     depth = request.headers.getHeader("depth", "0")
     if depth != "0":
-        log.err("Error in principal-search-property-set REPORT, Depth set to %s" % (depth,))
+        log.error("Error in principal-search-property-set REPORT, Depth set to %s" % (depth,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,)))
     
     # Get details from the resource
     result = self.principalSearchPropertySet()
     if result is None:
-        log.err("Error in principal-search-property-set REPORT not supported on: %s" % (self,))
+        log.error("Error in principal-search-property-set REPORT not supported on: %s" % (self,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Not allowed on this resource"))
         
     yield Response(code=responsecode.OK, stream=MemoryStream(result.toxml()))

Modified: CalendarServer/trunk/twext/web2/dav/resource.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/resource.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/resource.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -1001,7 +1001,7 @@
                 # on the resource
                 def gotDetails(details, creds):
                     if details == (None, None):
-                        log.msg(
+                        log.info(
                             "Could not find the principal resource for user id: %s"
                             % (creds.username,)
                         )
@@ -1021,7 +1021,7 @@
 
                 def translateUnauthenticated(f):
                     f.trap(UnauthorizedLogin, LoginFailed)
-                    log.msg("Authentication failed: %s" % (f.value,))
+                    log.info("Authentication failed: %s" % (f.value,))
                     d = UnauthorizedResponse.makeResponse(
                         request.credentialFactories, request.remoteAddr
                     )
@@ -1173,9 +1173,9 @@
                 if (ace.principal == old_ace.principal):
                     # Step 1
                     if old_ace.protected:
-                        log.err("Attempt to overwrite protected ace %r "
-                                "on resource %r"
-                                % (old_ace, self))
+                        log.error("Attempt to overwrite protected ace %r "
+                                  "on resource %r"
+                                  % (old_ace, self))
                         returnValue((
                             element.dav_namespace,
                             "no-protected-ace-conflict"
@@ -1195,8 +1195,8 @@
                     # Otherwise, we'd use this logic:
                     #
                     #elif old_ace.inherited:
-                    #    log.err("Attempt to overwrite inherited ace %r "
-                    #            "on resource %r" % (old_ace, self))
+                    #    log.error("Attempt to overwrite inherited ace %r "
+                    #              "on resource %r" % (old_ace, self))
                     #    returnValue((
                     #        element.dav_namespace,
                     #        "no-inherited-ace-conflict"
@@ -1204,9 +1204,9 @@
 
             # Step 3
             if ace.allow and got_deny:
-                log.err("Attempt to set grant ace %r after deny ace "
-                        "on resource %r"
-                        % (ace, self))
+                log.error("Attempt to set grant ace %r after deny ace "
+                          "on resource %r"
+                          % (ace, self))
                 returnValue((element.dav_namespace, "deny-before-grant"))
             got_deny = not ace.allow
 
@@ -1216,21 +1216,21 @@
             # Step 5
             for privilege in ace.privileges:
                 if privilege.children[0] not in supported:
-                    log.err("Attempt to use unsupported privilege %r "
-                            "in ace %r on resource %r"
-                            % (privilege.children[0], ace, self))
+                    log.error("Attempt to use unsupported privilege %r "
+                              "in ace %r on resource %r"
+                              % (privilege.children[0], ace, self))
                     returnValue((
                         element.dav_namespace,
                         "not-supported-privilege"
                     ))
 
             if ace.protected:
-                log.err("Attempt to create protected ace %r on resource %r"
-                        % (ace, self))
+                log.error("Attempt to create protected ace %r on resource %r"
+                          % (ace, self))
                 returnValue((element.dav_namespace, "no-ace-conflict"))
 
             if ace.inherited:
-                log.err("Attempt to create inherited ace %r on resource %r"
+                log.error("Attempt to create inherited ace %r on resource %r"
                         % (ace, self))
                 returnValue((element.dav_namespace, "no-ace-conflict"))
 
@@ -1238,9 +1238,9 @@
             valid = (yield self.validPrincipal(ace.principal, request))
 
             if not valid:
-                log.err("Attempt to use unrecognized principal %r "
-                        "in ace %r on resource %r"
-                        % (ace.principal, ace, self))
+                log.error("Attempt to use unrecognized principal %r "
+                          "in ace %r on resource %r"
+                          % (ace.principal, ace, self))
                 returnValue((element.dav_namespace, "recognized-principal"))
 
         # Step 8 & 9
@@ -1781,9 +1781,9 @@
             if isinstance(real_principal, element.Property):
                 # See comments in matchPrincipal().  We probably need
                 # some common code.
-                log.err("Encountered a property principal (%s), "
-                        "but handling is not implemented."
-                        % (real_principal,))
+                log.error("Encountered a property principal (%s), "
+                          "but handling is not implemented."
+                          % (real_principal,))
                 return False
 
             if isinstance(real_principal, element.HRef):
@@ -1851,9 +1851,9 @@
             #
             # Note: When fixing this, also fix validPrincipal()
             #
-            log.err("Encountered a property principal (%s), "
-                    "but handling is not implemented; invalid for ACL use."
-                    % (principal,))
+            log.error("Encountered a property principal (%s), "
+                      "but handling is not implemented; invalid for ACL use."
+                      % (principal,))
             return succeed(None)
 
             #
@@ -1874,9 +1874,9 @@
                     return None
 
                 if not isinstance(principal, element.Principal):
-                    log.err("Non-principal value in property %s "
-                            "referenced by property principal."
-                            % (encodeXMLName(namespace, name),))
+                    log.error("Non-principal value in property %s "
+                              "referenced by property principal."
+                              % (encodeXMLName(namespace, name),))
                     return None
 
                 if len(principal.children) != 1:
@@ -1895,8 +1895,8 @@
             try:
                 self = IDAVPrincipalResource(self)
             except TypeError:
-                log.err("DAV:self ACE is set on non-principal resource %r"
-                        % (self,))
+                log.error("DAV:self ACE is set on non-principal resource %r"
+                          % (self,))
                 return succeed(None)
             principal = element.HRef(self.principalURL())
 
@@ -2233,9 +2233,9 @@
             else:
                 # Remove the dead property and re-read to do brute
                 # force quota calc
-                log.msg("Attempt to set quota used to a negative value: %s "
-                        "(adjustment: %s)"
-                        % (size, adjust,))
+                log.info("Attempt to set quota used to a negative value: %s "
+                         "(adjustment: %s)"
+                         % (size, adjust,))
                 self.removeDeadProperty(TwistedQuotaUsedProperty)
                 return self.currentQuotaUse(request)
 
@@ -2250,7 +2250,7 @@
     def renderHTTP(self, request):
         # FIXME: This is for testing with litmus; comment out when not in use
         #litmus = request.headers.getRawHeaders("x-litmus")
-        #if litmus: log.msg("*** Litmus test: %s ***" % (litmus,))
+        #if litmus: log.info("*** Litmus test: %s ***" % (litmus,))
 
         #
         # If this is a collection and the URI doesn't end in "/", redirect.

Modified: CalendarServer/trunk/twext/web2/dav/static.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/static.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/static.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -47,8 +47,8 @@
 try:
     from twext.web2.dav.xattrprops import xattrPropertyStore as DeadPropertyStore
 except ImportError:
-    log.msg("No dead property store available; using nonePropertyStore.")
-    log.msg("Setting of dead properties will not be allowed.")
+    log.info("No dead property store available; using nonePropertyStore.")
+    log.info("Setting of dead properties will not be allowed.")
     from twext.web2.dav.noneprops import NonePropertyStore as DeadPropertyStore
 
 class DAVFile (DAVResource, File):

Modified: CalendarServer/trunk/twext/web2/dav/test/util.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/test/util.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/test/util.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -214,7 +214,7 @@
 
     def _getDocumentRoot(self):
         if not hasattr(self, "_docroot"):
-            log.msg("Setting up docroot for %s" % (self.__class__,))
+            log.info("Setting up docroot for %s" % (self.__class__,))
 
             self._docroot = self.createDocumentRoot()
 
@@ -271,7 +271,7 @@
         @return: asynchronously return a response object or L{None}
         @rtype: L{Deferred} firing L{Response} or L{None}
         """
-        log.msg("Sending %s request for URI %s" % (request.method, request.uri))
+        log.info("Sending %s request for URI %s" % (request.method, request.uri))
 
         d = request.locateResource(request.uri)
         d.addCallback(lambda resource: resource.renderHTTP(request))

Modified: CalendarServer/trunk/twext/web2/dav/util.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/util.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/dav/util.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -83,7 +83,7 @@
             doc.root_element.validate()
             return doc
         except ValueError:
-            log.err("Bad XML:\n%s" % (xml,))
+            log.error("Bad XML:\n%s" % (xml,))
             raise
     return allDataFromStream(stream, parse)
 
@@ -193,7 +193,7 @@
         try:
             __import__(module.__name__ + "." + submodule_name)
         except ImportError:
-            log.err("Unable to import module %s" % (module.__name__ + "." + submodule_name,))
+            log.error("Unable to import module %s" % (module.__name__ + "." + submodule_name,))
             Failure().raiseException()
         submodule = getattr(module, submodule_name)
         for method_name in submodule.__all__:

Modified: CalendarServer/trunk/twext/web2/http.py
===================================================================
--- CalendarServer/trunk/twext/web2/http.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/http.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -30,7 +30,7 @@
 Maintainer: James Y Knight
 
 """
-#        import traceback; log.msg(''.join(traceback.format_stack()))
+#        import traceback; log.info(''.join(traceback.format_stack()))
 
 import json
 import time
@@ -489,9 +489,9 @@
 
     def _error(self, reason):
         if reason.check(error.ConnectionLost):
-            log.msg("Request error: " + reason.getErrorMessage())
+            log.info("Request error: " + reason.getErrorMessage())
         else:
-            log.err(reason)
+            log.failure(reason)
             # Only bother with cleanup on errors other than lost connection.
             self.chanRequest.abortConnection()
 

Modified: CalendarServer/trunk/twext/web2/log.py
===================================================================
--- CalendarServer/trunk/twext/web2/log.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/log.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -94,7 +94,7 @@
         if length:        
             request.timeStamp("t-resp-wr")
         log.msg(interface=iweb.IRequest, request=request, response=response,
-                 loginfo=loginfo)
+                loginfo=loginfo)
         # Or just...
         # ILogger(ctx).log(...) ?
 

Modified: CalendarServer/trunk/twext/web2/metafd.py
===================================================================
--- CalendarServer/trunk/twext/web2/metafd.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/metafd.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -201,7 +201,7 @@
                 # newConnectionStatus)
                 result = self.intWithNoneAsZero(previousStatus) - 1
                 if result < 0:
-                    log.err("metafd: trying to decrement status below zero")
+                    log.error("metafd: trying to decrement status below zero")
                     result = 0
             else:
                 # A new process just started accepting new connections; zero
@@ -210,7 +210,7 @@
                 if previousStatus is None:
                     result = 0
                 else:
-                    log.err("metafd: trying to zero status that is not None")
+                    log.error("metafd: trying to zero status that is not None")
                     result = previousStatus
 
             # If load has indeed decreased (i.e. in any case except 'a new,

Modified: CalendarServer/trunk/twext/web2/server.py
===================================================================
--- CalendarServer/trunk/twext/web2/server.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/server.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -351,7 +351,7 @@
 
     def process(self):
         "Process a request."
-        log.msg("%s %s %s" % (
+        log.info("%s %s %s" % (
             self.method,
             self.uri,
             "HTTP/%s.%s" % self.clientproto
@@ -629,10 +629,10 @@
         return d
 
     def _processingReallyFailed(self, reason, origReason):
-        log.msg("Exception rendering error page:", isErr=1)
-        log.err(reason)
-        log.msg("Original exception:", isErr=1)
-        log.err(origReason)
+        log.info("Exception rendering error page:", isErr=1)
+        log.failure(reason)
+        log.info("Original exception:", isErr=1)
+        log.failure(origReason)
 
         body = ("<html><head><title>Internal Server Error</title></head>"
                 "<body><h1>Internal Server Error</h1>An error occurred rendering the requested page. Additionally, an error occurred rendering the error page.</body></html>")
@@ -670,8 +670,8 @@
         raise TypeError("html is not a resource or a response")
 
     def renderHTTP_exception(self, req, reason):
-        log.msg("Exception rendering:", isErr=1)
-        log.err(reason)
+        log.info("Exception rendering:", isErr=1)
+        log.failure(reason)
 
         body = ("<html><head><title>Internal Server Error</title></head>"
                 "<body><h1>Internal Server Error</h1>An error occurred rendering the requested page. More information is available in the server log.</body></html>")

Modified: CalendarServer/trunk/twext/web2/stream.py
===================================================================
--- CalendarServer/trunk/twext/web2/stream.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twext/web2/stream.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -59,10 +59,16 @@
 from zope.interface import Interface, Attribute, implements
 from twisted.internet.defer import Deferred
 from twisted.internet import interfaces as ti_interfaces, defer, reactor, protocol, error as ti_error
-from twisted.python import components, log
+from twisted.python import components
 from twisted.python.failure import Failure
 from twisted.python.hashlib import md5
 
+from twext.python.log import Logger
+
+log = Logger()
+
+
+
 # Python 2.4.2 (only) has a broken mmap that leaks a fd every time you call it.
 if sys.version_info[0:3] != (2,4,2):
     try:
@@ -831,8 +837,8 @@
                        self._inputError)
 
     def _inputError(self, f):
-        log.msg("Error in input stream for %r" % self.transport)
-        log.err(f)
+        log.info("Error in input stream for %r" % self.transport)
+        log.failure(f)
         self.transport.closeStdin()
     
     def outReceived(self, data):

Modified: CalendarServer/trunk/twistedcaldav/caldavxml.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/caldavxml.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/caldavxml.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -118,16 +118,16 @@
         """
 
         if self.start is not None and self.start.isDateOnly():
-            log.msg("start attribute in <time-range> is not a date-time: %s" % (self.start,))
+            log.info("start attribute in <time-range> is not a date-time: %s" % (self.start,))
             return False
         if self.end is not None and self.end.isDateOnly():
-            log.msg("end attribute in <time-range> is not a date-time: %s" % (self.end,))
+            log.info("end attribute in <time-range> is not a date-time: %s" % (self.end,))
             return False
         if self.start is not None and not self.start.utc():
-            log.msg("start attribute in <time-range> is not UTC: %s" % (self.start,))
+            log.info("start attribute in <time-range> is not UTC: %s" % (self.start,))
             return False
         if self.end is not None and not self.end.utc():
-            log.msg("end attribute in <time-range> is not UTC: %s" % (self.end,))
+            log.info("end attribute in <time-range> is not UTC: %s" % (self.end,))
             return False
 
         # No other tests

Modified: CalendarServer/trunk/twistedcaldav/client/geturl.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/client/geturl.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/client/geturl.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -87,12 +87,12 @@
     try:
         response = (yield agent.request(method, url, headers, None))
     except Exception, e:
-        log.err(str(e))
+        log.error(str(e))
         response = None
     else:
         if response.code in (MOVED_PERMANENTLY, FOUND, TEMPORARY_REDIRECT,):
             if redirect > 3:
-                log.err("Too many redirects")
+                log.error("Too many redirects")
             else:
                 location = response.headers.getRawHeaders("location")
                 if location:
@@ -102,7 +102,7 @@
                         newresponse.location = urlunparse((scheme, netloc, url, None, None, None,))
                     returnValue(newresponse)
                 else:
-                    log.err("Redirect without a Location header")
+                    log.error("Redirect without a Location header")
 
     if response is not None and response.code / 100 == 2:
         protocol = AccumulatingProtocol()

Modified: CalendarServer/trunk/twistedcaldav/database.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/database.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/database.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -116,16 +116,16 @@
                     if (version != self._db_version()) or (dbtype != self._db_type()):
 
                         if dbtype != self._db_type():
-                            log.err("Database %s has different type (%s vs. %s)"
-                                    % (self.dbID, dbtype, self._db_type()))
+                            log.error("Database %s has different type (%s vs. %s)"
+                                      % (self.dbID, dbtype, self._db_type()))
 
                             # Delete this index and start over
                             yield self._db_remove()
                             yield self._db_init()
 
                         elif version != self._db_version():
-                            log.err("Database %s has different schema (v.%s vs. v.%s)"
-                                    % (self.dbID, version, self._db_version()))
+                            log.error("Database %s has different schema (v.%s vs. v.%s)"
+                                      % (self.dbID, version, self._db_version()))
                             
                             # Upgrade the DB
                             yield self._db_upgrade(version)
@@ -145,7 +145,7 @@
             try:
                 self.pool.close()
             except Exception, e:
-                log.err("Error whilst closing connection pool: %s" % (e,))
+                log.error("Error whilst closing connection pool: %s" % (e,))
             self.pool = None
             self.initialized = False
 
@@ -160,7 +160,7 @@
             try:
                 yield self._db_empty_data_tables()
             except Exception, e:
-                log.err("Error in database clean: %s" % (e,))
+                log.error("Error in database clean: %s" % (e,))
                 self.close()
             else:
                 break
@@ -176,7 +176,7 @@
             try:
                 yield self._db_execute(sql, *query_params)
             except Exception, e:
-                log.err("Error in database execute: %s" % (e,))
+                log.error("Error in database execute: %s" % (e,))
                 self.close()
             else:
                 break
@@ -192,7 +192,7 @@
             try:
                 yield self._db_execute_script(script)
             except Exception, e:
-                log.err("Error in database executescript: %s" % (e,))
+                log.error("Error in database executescript: %s" % (e,))
                 self.close()
             else:
                 break
@@ -208,7 +208,7 @@
             try:
                 result = (yield self._db_all_values_for_sql(sql, *query_params))
             except Exception, e:
-                log.err("Error in database query: %s" % (e,))
+                log.error("Error in database query: %s" % (e,))
                 self.close()
             else:
                 break
@@ -226,7 +226,7 @@
             try:
                 result = (yield self._db_values_for_sql(sql, *query_params))
             except Exception, e:
-                log.err("Error in database queryList: %s" % (e,))
+                log.error("Error in database queryList: %s" % (e,))
                 self.close()
             else:
                 break
@@ -244,7 +244,7 @@
             try:
                 result = (yield self._db_value_for_sql(sql, *query_params))
             except Exception, e:
-                log.err("Error in database queryOne: %s" % (e,))
+                log.error("Error in database queryOne: %s" % (e,))
                 self.close()
             else:
                 break
@@ -271,7 +271,7 @@
         """
         Initialise the underlying database tables.
         """
-        log.msg("Initializing database %s" % (self.dbID,))
+        log.info("Initializing database %s" % (self.dbID,))
 
         # TODO we need an exclusive lock of some kind here to prevent a race condition
         # in which multiple processes try to create the tables.

Modified: CalendarServer/trunk/twistedcaldav/directory/principal.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directory/principal.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/directory/principal.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -368,7 +368,7 @@
     ##
 
     def createSimilarFile(self, path):
-        log.err("Attempt to create clone %r of resource %r" % (path, self))
+        log.error("Attempt to create clone %r of resource %r" % (path, self))
         raise HTTPError(responsecode.NOT_FOUND)
 
 
@@ -452,7 +452,7 @@
 
 
     def createSimilarFile(self, path):
-        log.err("Attempt to create clone %r of resource %r" % (path, self))
+        log.error("Attempt to create clone %r of resource %r" % (path, self))
         raise HTTPError(responsecode.NOT_FOUND)
 
 
@@ -533,7 +533,7 @@
 
 
     def createSimilarFile(self, path):
-        log.err("Attempt to create clone %r of resource %r" % (path, self))
+        log.error("Attempt to create clone %r of resource %r" % (path, self))
         raise HTTPError(responsecode.NOT_FOUND)
 
 
@@ -981,7 +981,7 @@
                 if relative not in records:
                     found = self.parent.principalForRecord(relative)
                     if found is None:
-                        log.err("No principal found for directory record: %r" % (relative,))
+                        log.error("No principal found for directory record: %r" % (relative,))
                     else:
                         if proxy:
                             if proxy == "read-write":
@@ -1174,7 +1174,7 @@
 
 
     def createSimilarFile(self, path):
-        log.err("Attempt to create clone %r of resource %r" % (path, self))
+        log.error("Attempt to create clone %r of resource %r" % (path, self))
         raise HTTPError(responsecode.NOT_FOUND)
 
 
@@ -1462,7 +1462,7 @@
                 yield item
             yield "\n"
     except Exception, e:
-        log.err("Exception while rendering: %s" % (e,))
+        log.error("Exception while rendering: %s" % (e,))
         Failure().printTraceback()
         yield "  ** %s **: %s\n" % (e.__class__.__name__, e)
     if not thereAreAny:

Modified: CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/directorybackedaddressbook.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -63,7 +63,7 @@
 #                gid = grp.getgrnam(config.GroupName)[2]
 #                os.chown(path, uid, gid)
 # 
-#            log.msg("Created %s" % (path,))
+#            log.info("Created %s" % (path,))
 #            
 #        except (OSError,), e:
 #            # this is caused by multiprocessor race and is harmless

Modified: CalendarServer/trunk/twistedcaldav/extensions.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/extensions.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/extensions.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -107,7 +107,7 @@
         # Only handle Depth: 0
         depth = request.headers.getHeader("depth", "0")
         if depth != "0":
-            log.err("Error in principal-property-search REPORT, Depth set to %s" % (depth,))
+            log.error("Error in principal-property-search REPORT, Depth set to %s" % (depth,))
             raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,)))
 
         # Get any limit value from xml
@@ -236,8 +236,7 @@
 
         if resultsWereLimited is not None:
             if resultsWereLimited[0] == "server":
-                log.err("Too many matching resources in "
-                        "principal-property-search report")
+                log.error("Too many matching resources in principal-property-search report")
             responses.append(element.StatusResponse(
                 element.HRef.fromString(request.uri),
                 element.Status.fromResponseCode(
@@ -269,7 +268,7 @@
         # Only handle Depth: 0
         depth = request.headers.getHeader("depth", "0")
         if depth != "0":
-            log.err("Error in calendarserver-principal-search REPORT, Depth set to %s" % (depth,))
+            log.error("Error in calendarserver-principal-search REPORT, Depth set to %s" % (depth,))
             raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Depth %s not allowed" % (depth,)))
 
         tokens, context, applyTo, clientLimit, propElement = extractCalendarServerPrincipalSearchData(calendarserver_principal_search)
@@ -324,8 +323,7 @@
 
         if resultsWereLimited is not None:
             if resultsWereLimited[0] == "server":
-                log.err("Too many matching resources in "
-                        "calendarserver-principal-search report")
+                log.error("Too many matching resources in calendarserver-principal-search report")
             responses.append(element.StatusResponse(
                 element.HRef.fromString(request.uri),
                 element.Status.fromResponseCode(
@@ -418,9 +416,9 @@
                 f.trap(HTTPError)
                 code = f.value.response.code
                 if code == responsecode.NOT_FOUND:
-                    log.err("Property %s was returned by listProperties() "
-                            "but does not exist for resource %s."
-                            % (name, self.resource))
+                    log.error("Property %s was returned by listProperties() "
+                              "but does not exist for resource %s."
+                              % (name, self.resource))
                     return (name, None)
                 if code == responsecode.UNAUTHORIZED:
                     return (name, accessDeniedValue)

Modified: CalendarServer/trunk/twistedcaldav/freebusyurl.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/freebusyurl.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/freebusyurl.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -261,7 +261,7 @@
         try:
             inbox = (yield request.locateResource(inboxURL))
         except:
-            log.err("No schedule inbox for principal: %s" % (principal,))
+            log.error("No schedule inbox for principal: %s" % (principal,))
             inbox = None
         if inbox is None:
             raise HTTPError(StatusResponse(responsecode.INTERNAL_SERVER_ERROR, "No schedule inbox for principal: %s" % (principal,)))

Modified: CalendarServer/trunk/twistedcaldav/method/mkcalendar.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/mkcalendar.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/method/mkcalendar.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -51,7 +51,7 @@
     yield parent.authorize(request, (davxml.Bind(),))
 
     if self.exists():
-        log.err("Attempt to create collection where resource exists: %s" % (self,))
+        log.error("Attempt to create collection where resource exists: %s" % (self,))
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,
             (davxml.dav_namespace, "resource-must-be-null"),
@@ -59,8 +59,8 @@
         ))
 
     if not parent.isCollection():
-        log.err("Attempt to create collection with non-collection parent: %s"
-                % (self,))
+        log.error("Attempt to create collection with non-collection parent: %s"
+                  % (self,))
         raise HTTPError(ErrorResponse(
             responsecode.CONFLICT,
             (caldavxml.caldav_namespace, "calendar-collection-location-ok"),
@@ -74,7 +74,7 @@
         doc = (yield davXMLFromStream(request.stream))
         yield self.createCalendar(request)
     except ValueError, e:
-        log.err("Error while handling MKCALENDAR: %s" % (e,))
+        log.error("Error while handling MKCALENDAR: %s" % (e,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, str(e)))
 
     set_supported_component_set = False
@@ -83,7 +83,7 @@
         if not isinstance(makecalendar, caldavxml.MakeCalendar):
             error = ("Non-%s element in MKCALENDAR request body: %s"
                      % (caldavxml.MakeCalendar.name, makecalendar))
-            log.err(error)
+            log.error(error)
             raise HTTPError(StatusResponse(responsecode.UNSUPPORTED_MEDIA_TYPE, error))
 
         errors = PropertyStatusResponseQueue("PROPPATCH", request.uri, responsecode.NO_CONTENT)

Modified: CalendarServer/trunk/twistedcaldav/method/mkcol.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/mkcol.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/method/mkcol.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -54,8 +54,8 @@
     yield parent.authorize(request, (davxml.Bind(),))
 
     if self.exists():
-        log.err("Attempt to create collection where resource exists: %s"
-                % (self,))
+        log.error("Attempt to create collection where resource exists: %s"
+                  % (self,))
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,
             (davxml.dav_namespace, "resource-must-be-null"),
@@ -63,8 +63,8 @@
         ))
 
     if not parent.isCollection():
-        log.err("Attempt to create collection with non-collection parent: %s"
-                % (self,))
+        log.error("Attempt to create collection with non-collection parent: %s"
+                  % (self,))
         raise HTTPError(ErrorResponse(
             responsecode.CONFLICT,
             (davxml.dav_namespace, "collection-location-ok"),
@@ -99,7 +99,7 @@
     try:
         doc = (yield davXMLFromStream(request.stream))
     except ValueError, e:
-        log.err("Error while handling MKCOL: %s" % (e,))
+        log.error("Error while handling MKCOL: %s" % (e,))
         # TODO: twext.web2.dav 'MKCOL' tests demand this particular response
         # code, but should we really be looking at the XML content or the
         # content-type header?  It seems to me like this ought to be considered
@@ -118,7 +118,7 @@
         if not isinstance(mkcol, mkcolxml.MakeCollection):
             error = ("Non-%s element in MKCOL request body: %s"
                      % (mkcolxml.MakeCollection.name, mkcol))
-            log.err(error)
+            log.error(error)
             raise HTTPError(StatusResponse(responsecode.UNSUPPORTED_MEDIA_TYPE, error))
 
         errors = PropertyStatusResponseQueue("PROPPATCH", request.uri, responsecode.NO_CONTENT)
@@ -135,7 +135,7 @@
                 if isinstance(property, davxml.ResourceType):
                     if rtype:
                         error = "Multiple {DAV:}resourcetype properties in MKCOL request body: %s" % (mkcol,)
-                        log.err(error)
+                        log.error(error)
                         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
                     else:
                         if property.childrenOfType(davxml.Collection):
@@ -146,18 +146,18 @@
 
             if not rtype:
                 error = "No {DAV:}resourcetype property in MKCOL request body: %s" % (mkcol,)
-                log.err(error)
+                log.error(error)
                 raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
             elif rtype not in ("calendar", "addressbook"):
                 error = "{DAV:}resourcetype property in MKCOL request body not supported: %s" % (mkcol,)
-                log.err(error)
+                log.error(error)
                 raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
 
             # Make sure feature is enabled
             if (rtype == "calendar" and not config.EnableCalDAV or
                 rtype == "addressbook" and not config.EnableCardDAV):
                 error = "{DAV:}resourcetype property in MKCOL request body not supported: %s" % (mkcol,)
-                log.err(error)
+                log.error(error)
                 raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
 
             # Now create the special collection

Modified: CalendarServer/trunk/twistedcaldav/method/propfind.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/propfind.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/method/propfind.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -57,7 +57,7 @@
         parent = (yield request.locateResource(parentURL))
         yield parent.authorize(request, (davxml.Bind(),))
 
-        log.err("Resource not found: %s" % (self,))
+        log.error("Resource not found: %s" % (self,))
         raise HTTPError(responsecode.NOT_FOUND)
 
     #
@@ -71,7 +71,7 @@
     try:
         doc = (yield davXMLFromStream(request.stream))
     except ValueError, e:
-        log.err("Error while handling PROPFIND body: %s" % (e,))
+        log.error("Error while handling PROPFIND body: %s" % (e,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, str(e)))
 
     if doc is None:
@@ -85,7 +85,7 @@
         if not isinstance(find, davxml.PropertyFind):
             error = ("Non-%s element in PROPFIND request body: %s"
                      % (davxml.PropertyFind.sname(), find))
-            log.err(error)
+            log.error(error)
             raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, error))
 
         container = find.children[0]
@@ -158,7 +158,7 @@
                 try:
                     resource_properties = (yield resource.listProperties(request))
                 except:
-                    log.err("Unable to get properties for resource %r" % (resource,))
+                    log.error("Unable to get properties for resource %r" % (resource,))
                     raise
 
                 properties_by_status = {

Modified: CalendarServer/trunk/twistedcaldav/method/report.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/method/report.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -49,7 +49,7 @@
     Respond to a REPORT request. (RFC 3253, section 3.6)
     """
     if not self.exists():
-        log.err("Resource not found: %s" % (self,))
+        log.error("Resource not found: %s" % (self,))
         raise HTTPError(responsecode.NOT_FOUND)
 
     #
@@ -58,7 +58,7 @@
     try:
         doc = (yield davXMLFromStream(request.stream))
     except ValueError, e:
-        log.err("Error while handling REPORT body: %s" % (e,))
+        log.error("Error while handling REPORT body: %s" % (e,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, str(e)))
 
     if doc is None:
@@ -116,8 +116,8 @@
         #
         # Requested report is not supported.
         #
-        log.err("Unsupported REPORT %s for resource %s (no method %s)"
-                % (encodeXMLName(namespace, name), self, method_name))
+        log.error("Unsupported REPORT %s for resource %s (no method %s)"
+                  % (encodeXMLName(namespace, name), self, method_name))
 
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,

Modified: CalendarServer/trunk/twistedcaldav/method/report_addressbook_query.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_addressbook_query.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/method/report_addressbook_query.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -56,7 +56,7 @@
     if not self.isCollection():
         parent = (yield self.locateParent(request, request.uri))
         if not parent.isAddressBookCollection():
-            log.err("addressbook-query report is not allowed on a resource outside of an address book collection %s" % (self,))
+            log.error("addressbook-query report is not allowed on a resource outside of an address book collection %s" % (self,))
             raise HTTPError(StatusResponse(responsecode.FORBIDDEN, "Must be address book collection or address book resource"))
 
     responses = []
@@ -82,7 +82,7 @@
         # Verify that any address-data element matches what we can handle
         result, message, generate_address_data = report_common.validPropertyListAddressDataTypeVersion(query)
         if not result:
-            log.err(message)
+            log.error(message)
             raise HTTPError(ErrorResponse(
                 responsecode.FORBIDDEN,
                 (carddav_namespace, "supported-address-data"),
@@ -94,7 +94,7 @@
 
     # Verify that the filter element is valid
     if (filter is None) or not filter.valid():
-        log.err("Invalid filter element: %r" % (filter,))
+        log.error("Invalid filter element: %r" % (filter,))
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,
             (carddav_namespace, "valid-filter"),
@@ -153,7 +153,7 @@
                     # of one of these resources in another request.  In this
                     # case, we ignore the now missing resource rather
                     # than raise an error for the entire report.
-                    log.err("Missing resource during sync: %s" % (href,))
+                    log.error("Missing resource during sync: %s" % (href,))
 
 
         @inlineCallbacks
@@ -177,7 +177,7 @@
                         # of one of these resources in another request.  In this
                         # case, we ignore the now missing resource rather
                         # than raise an error for the entire report.
-                        log.err("Missing resource during sync: %s" % (vCardRecord.hRef(),))
+                        log.error("Missing resource during sync: %s" % (vCardRecord.hRef(),))
 
         directoryAddressBookLock = None
         try:

Modified: CalendarServer/trunk/twistedcaldav/method/report_calendar_query.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_calendar_query.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/method/report_calendar_query.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -59,7 +59,7 @@
     if not self.isCollection():
         parent = (yield self.locateParent(request, request.uri))
         if not parent.isPseudoCalendarCollection():
-            log.err("calendar-query report is not allowed on a resource outside of a calendar collection %s" % (self,))
+            log.error("calendar-query report is not allowed on a resource outside of a calendar collection %s" % (self,))
             raise HTTPError(StatusResponse(responsecode.FORBIDDEN, "Must be calendar collection or calendar resource"))
 
     responses = []
@@ -75,7 +75,7 @@
     query_tz = calendar_query.timezone
     if query_tz is not None and not query_tz.valid():
         msg = "CalDAV:timezone must contain one VTIMEZONE component only: %s" % (query_tz,)
-        log.err(msg)
+        log.error(msg)
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,
             (caldav_namespace, "valid-calendar-data"),
@@ -99,7 +99,7 @@
         # Verify that any calendar-data element matches what we can handle
         result, message, generate_calendar_data = report_common.validPropertyListCalendarDataTypeVersion(props)
         if not result:
-            log.err(message)
+            log.error(message)
             raise HTTPError(ErrorResponse(
                 responsecode.FORBIDDEN,
                 (caldav_namespace, "supported-calendar-data"),
@@ -111,7 +111,7 @@
 
     # Verify that the filter element is valid
     if (filter is None) or not filter.valid():
-        log.err("Invalid filter element: %r" % (xmlfilter,))
+        log.error("Invalid filter element: %r" % (xmlfilter,))
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,
             (caldav_namespace, "valid-filter"),
@@ -165,7 +165,7 @@
                     # of one of these resources in another request.  In this
                     # case, we ignore the now missing resource rather
                     # than raise an error for the entire report.
-                    log.err("Missing resource during query: %s" % (href,))
+                    log.error("Missing resource during query: %s" % (href,))
 
         # Check whether supplied resource is a calendar or a calendar object resource
         if calresource.isPseudoCalendarCollection():
@@ -251,14 +251,14 @@
         depth = request.headers.getHeader("depth", "0")
         yield report_common.applyToCalendarCollections(self, request, request.uri, depth, doQuery, (davxml.Read(),))
     except TooManyInstancesError, ex:
-        log.err("Too many instances need to be computed in calendar-query report")
+        log.error("Too many instances need to be computed in calendar-query report")
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,
             MaxInstances.fromString(str(ex.max_allowed)),
             "Too many instances",
         ))
     except NumberOfMatchesWithinLimits:
-        log.err("Too many matching components in calendar-query report")
+        log.error("Too many matching components in calendar-query report")
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,
             davxml.NumberOfMatchesWithinLimits(),

Modified: CalendarServer/trunk/twistedcaldav/method/report_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_common.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/method/report_common.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -680,7 +680,7 @@
             # between our initial index query and getting here. For now we will ignore this error, but in
             # the longer term we need to implement some form of locking, perhaps.
             if calendar is None:
-                log.err("Calendar %s is missing from calendar collection %r" % (name, calresource))
+                log.error("Calendar %s is missing from calendar collection %r" % (name, calresource))
                 continue
 
             # Ignore ones of this UID

Modified: CalendarServer/trunk/twistedcaldav/method/report_freebusy.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_freebusy.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/method/report_freebusy.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -45,7 +45,7 @@
     (CalDAV-access-09, section 7.8)
     """
     if not self.isCollection():
-        log.err("freebusy report is only allowed on collection resources %s" % (self,))
+        log.error("freebusy report is only allowed on collection resources %s" % (self,))
         raise HTTPError(StatusResponse(responsecode.FORBIDDEN, "Not a calendar collection"))
 
     if freebusy.qname() != (caldavxml.caldav_namespace, "free-busy-query"):
@@ -81,7 +81,7 @@
         depth = request.headers.getHeader("depth", "0")
         yield report_common.applyToCalendarCollections(self, request, request.uri, depth, generateFreeBusyInfo, (caldavxml.ReadFreeBusy(),))
     except NumberOfMatchesWithinLimits:
-        log.err("Too many matching components in free-busy report")
+        log.error("Too many matching components in free-busy report")
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,
             davxml.NumberOfMatchesWithinLimits(),

Modified: CalendarServer/trunk/twistedcaldav/method/report_multiget_common.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_multiget_common.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/method/report_multiget_common.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -56,11 +56,11 @@
 
         if collection_type == COLLECTION_TYPE_CALENDAR:
             if not parent.isPseudoCalendarCollection():
-                log.err("calendar-multiget report is not allowed on a resource outside of a calendar collection %s" % (self,))
+                log.error("calendar-multiget report is not allowed on a resource outside of a calendar collection %s" % (self,))
                 raise HTTPError(StatusResponse(responsecode.FORBIDDEN, "Must be calendar resource"))
         elif collection_type == COLLECTION_TYPE_ADDRESSBOOK:
             if not parent.isAddressBookCollection():
-                log.err("addressbook-multiget report is not allowed on a resource outside of an address book collection %s" % (self,))
+                log.error("addressbook-multiget report is not allowed on a resource outside of an address book collection %s" % (self,))
                 raise HTTPError(StatusResponse(responsecode.FORBIDDEN, "Must be address book resource"))
 
     responses = []
@@ -93,7 +93,7 @@
         else:
             result = True
         if not result:
-            log.err(message)
+            log.error(message)
             raise HTTPError(ErrorResponse(
                 responsecode.FORBIDDEN,
                 precondition,
@@ -104,7 +104,7 @@
 
     # Check size of results is within limit when data property requested
     if hasData and len(resources) > config.MaxMultigetWithDataHrefs:
-        log.err("Too many results in multiget report returning data: %d" % len(resources))
+        log.error("Too many results in multiget report returning data: %d" % len(resources))
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,
             davxml.NumberOfMatchesWithinLimits(),
@@ -210,8 +210,8 @@
                         isowner=isowner
                     )
                 except ValueError:
-                    log.err("Invalid calendar resource during multiget: %s" %
-                            (href,))
+                    log.error("Invalid calendar resource during multiget: %s" %
+                              (href,))
                     responses.append(davxml.StatusResponse(
                         davxml.HRef.fromString(href),
                         davxml.Status.fromResponseCode(responsecode.FORBIDDEN)))
@@ -221,7 +221,7 @@
                     # of one of these resources in another request.  In this
                     # case, return a 404 for the now missing resource rather
                     # than raise an error for the entire report.
-                    log.err("Missing resource during multiget: %s" % (href,))
+                    log.error("Missing resource during multiget: %s" % (href,))
                     responses.append(davxml.StatusResponse(
                         davxml.HRef.fromString(href),
                         davxml.Status.fromResponseCode(responsecode.NOT_FOUND)
@@ -267,7 +267,7 @@
                     limit = config.DirectoryAddressBook.MaxQueryResults
                     directoryAddressBookLock, limited = (yield  self.directory.cacheVCardsForAddressBookQuery(addressBookFilter, propertyreq, limit))
                     if limited:
-                        log.err("Too many results in multiget report: %d" % len(resources))
+                        log.error("Too many results in multiget report: %d" % len(resources))
                         raise HTTPError(ErrorResponse(
                             responsecode.FORBIDDEN,
                             (dav_namespace, "number-of-matches-within-limits"),
@@ -278,7 +278,7 @@
                     limit = config.DirectoryAddressBook.MaxQueryResults
                     vCardRecords, limited = (yield self.directory.vCardRecordsForAddressBookQuery(addressBookFilter, propertyreq, limit))
                     if limited:
-                        log.err("Too many results in multiget report: %d" % len(resources))
+                        log.error("Too many results in multiget report: %d" % len(resources))
                         raise HTTPError(ErrorResponse(
                             responsecode.FORBIDDEN,
                             (dav_namespace, "number-of-matches-within-limits"),

Modified: CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/method/report_sync_collection.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -49,7 +49,7 @@
 
     # These resource support the report
     if not config.EnableSyncReport or element.Report(element.SyncCollection(),) not in self.supportedReports():
-        log.err("sync-collection report is only allowed on calendar/inbox/addressbook/notification collection resources %s" % (self,))
+        log.error("sync-collection report is only allowed on calendar/inbox/addressbook/notification collection resources %s" % (self,))
         raise HTTPError(ErrorResponse(
             responsecode.FORBIDDEN,
             element.SupportedReport(),
@@ -70,7 +70,7 @@
         descriptor = "Depth header without DAV:sync-level"
 
     if depth not in ("1", "infinity"):
-        log.err("sync-collection report with invalid depth header: %s" % (depth,))
+        log.error("sync-collection report with invalid depth header: %s" % (depth,))
         raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, "Invalid %s value" % (descriptor,)))
 
     propertyreq = sync_collection.property.children if sync_collection.property else None
@@ -106,7 +106,7 @@
                         properties_by_status[responsecode.OK].append(prop)
                     except:
                         f = Failure()
-                        log.err("Error reading property %r for resource %s: %s" % (qname, request.uri, f.value))
+                        log.error("Error reading property %r for resource %s: %s" % (qname, request.uri, f.value))
                         status = statusForFailure(f, "getting property: %s" % (qname,))
                         if status not in properties_by_status:
                             properties_by_status[status] = []
@@ -153,7 +153,7 @@
             # of one of these resources in another request.  In this
             # case, we ignore the now missing resource rather
             # than raise an error for the entire report.
-            log.err("Missing resource during sync: %s" % (href,))
+            log.error("Missing resource during sync: %s" % (href,))
 
     for child, child_uri in forbidden_resources:
         href = element.HRef.fromString(child_uri)
@@ -171,7 +171,7 @@
             # of one of these resources in another request.  In this
             # case, we ignore the now missing resource rather
             # than raise an error for the entire report.
-            log.err("Missing resource during sync: %s" % (href,))
+            log.error("Missing resource during sync: %s" % (href,))
 
     for name in removed:
         href = element.HRef.fromString(joinURL(request.uri, name))

Modified: CalendarServer/trunk/twistedcaldav/query/calendarqueryfilter.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/query/calendarqueryfilter.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/query/calendarqueryfilter.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -302,32 +302,32 @@
         if level == 0:
             # Must have VCALENDAR at the top
             if (self.filter_name != "VCALENDAR") or timerange:
-                log.msg("Top-level comp-filter must be VCALENDAR, instead: %s" % (self.filter_name,))
+                log.info("Top-level comp-filter must be VCALENDAR, instead: %s" % (self.filter_name,))
                 return False
         elif level == 1:
             # Disallow VCALENDAR, VALARM, STANDARD, DAYLIGHT, AVAILABLE at the top, everything else is OK
             if self.filter_name in ("VCALENDAR", "VALARM", "STANDARD", "DAYLIGHT", "AVAILABLE"):
-                log.msg("comp-filter wrong component type: %s" % (self.filter_name,))
+                log.info("comp-filter wrong component type: %s" % (self.filter_name,))
                 return False
 
             # time-range only on VEVENT, VTODO, VJOURNAL, VFREEBUSY, VAVAILABILITY
             if timerange and self.filter_name not in ("VEVENT", "VTODO", "VJOURNAL", "VFREEBUSY", "VAVAILABILITY"):
-                log.msg("time-range cannot be used with component %s" % (self.filter_name,))
+                log.info("time-range cannot be used with component %s" % (self.filter_name,))
                 return False
         elif level == 2:
             # Disallow VCALENDAR, VTIMEZONE, VEVENT, VTODO, VJOURNAL, VFREEBUSY, VAVAILABILITY at the top, everything else is OK
             if (self.filter_name in ("VCALENDAR", "VTIMEZONE", "VEVENT", "VTODO", "VJOURNAL", "VFREEBUSY", "VAVAILABILITY")):
-                log.msg("comp-filter wrong sub-component type: %s" % (self.filter_name,))
+                log.info("comp-filter wrong sub-component type: %s" % (self.filter_name,))
                 return False
 
             # time-range only on VALARM, AVAILABLE
             if timerange and self.filter_name not in ("VALARM", "AVAILABLE",):
-                log.msg("time-range cannot be used with sub-component %s" % (self.filter_name,))
+                log.info("time-range cannot be used with sub-component %s" % (self.filter_name,))
                 return False
         else:
             # Disallow all standard iCal components anywhere else
             if (self.filter_name in ("VCALENDAR", "VTIMEZONE", "VEVENT", "VTODO", "VJOURNAL", "VFREEBUSY", "VALARM", "STANDARD", "DAYLIGHT", "AVAILABLE")) or timerange:
-                log.msg("comp-filter wrong standard component type: %s" % (self.filter_name,))
+                log.info("comp-filter wrong standard component type: %s" % (self.filter_name,))
                 return False
 
         # Test each property
@@ -450,7 +450,7 @@
 
         # time-range only on COMPLETED, CREATED, DTSTAMP, LAST-MODIFIED
         if timerange and self.filter_name.upper() not in ("COMPLETED", "CREATED", "DTSTAMP", "LAST-MODIFIED"):
-            log.msg("time-range cannot be used with property %s" % (self.filter_name,))
+            log.info("time-range cannot be used with property %s" % (self.filter_name,))
             return False
 
         # Test the time-range
@@ -669,16 +669,16 @@
         """
 
         if self.start is not None and self.start.isDateOnly():
-            log.msg("start attribute in <time-range> is not a date-time: %s" % (self.start,))
+            log.info("start attribute in <time-range> is not a date-time: %s" % (self.start,))
             return False
         if self.end is not None and self.end.isDateOnly():
-            log.msg("end attribute in <time-range> is not a date-time: %s" % (self.end,))
+            log.info("end attribute in <time-range> is not a date-time: %s" % (self.end,))
             return False
         if self.start is not None and not self.start.utc():
-            log.msg("start attribute in <time-range> is not UTC: %s" % (self.start,))
+            log.info("start attribute in <time-range> is not UTC: %s" % (self.start,))
             return False
         if self.end is not None and not self.end.utc():
-            log.msg("end attribute in <time-range> is not UTC: %s" % (self.end,))
+            log.info("end attribute in <time-range> is not UTC: %s" % (self.end,))
             return False
 
         # No other tests

Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/resource.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -1370,7 +1370,7 @@
 
         # newStore guarantees that we always have a parent calendar home
         #if not self.fp.parent().isdir():
-        #    log.err("Attempt to create collection with no parent: %s" % (self.fp.path,))
+        #    log.error("Attempt to create collection with no parent: %s" % (self.fp.path,))
         #    raise HTTPError(StatusResponse(responsecode.CONFLICT, "No parent collection"))
 
         #
@@ -1466,7 +1466,7 @@
 
         # newStore guarantees that we always have a parent calendar home
         #if not os.path.isdir(os.path.dirname(self.fp.path)):
-        #    log.err("Attempt to create collection with no parent: %s" % (self.fp.path,))
+        #    log.error("Attempt to create collection with no parent: %s" % (self.fp.path,))
         #    raise HTTPError(StatusResponse(responsecode.CONFLICT, "No parent collection"))
 
         #

Modified: CalendarServer/trunk/twistedcaldav/sql.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/sql.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/sql.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -120,16 +120,16 @@
                         del(self._db_connection)
 
                         if dbtype != self._db_type():
-                            log.err("Database %s has different type (%s vs. %s)"
-                                    % (db_filename, dbtype, self._db_type()))
+                            log.error("Database %s has different type (%s vs. %s)"
+                                      % (db_filename, dbtype, self._db_type()))
 
                             # Delete this index and start over
                             os.remove(db_filename)
                             return self._db()
 
                         if version != self._db_version():
-                            log.err("Database %s has different schema (v.%s vs. v.%s)"
-                                    % (db_filename, version, self._db_version()))
+                            log.error("Database %s has different schema (v.%s vs. v.%s)"
+                                      % (db_filename, version, self._db_version()))
                             
                             # Upgrade the DB
                             return self._db_upgrade(version)
@@ -176,7 +176,7 @@
         @param db_filename: the file name of the index database.
         @param q:           a database cursor to use.
         """
-        log.msg("Initializing database %s" % (db_filename,))
+        log.info("Initializing database %s" % (db_filename,))
 
         # We need an exclusive lock here as we are making a big change to the database and we don't
         # want other processes to get stomped on or stomp on us.
@@ -342,7 +342,7 @@
             self.lastrowid = q.lastrowid
             return q.fetchall()
         except DatabaseError:
-            log.err("Exception while executing SQL on DB %s: %r %r" % (self, sql, query_params))
+            log.error("Exception while executing SQL on DB %s: %r %r" % (self, sql, query_params))
             raise
         finally:
             q.close()

Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -26,7 +26,7 @@
 
 from twext.python.plistlib import PlistParser #@UnresolvedImport
 from twext.python.log import Logger, InvalidLogLevelError
-from twext.python.log import clearLogLevels, setLogLevelForNamespace
+from twext.python.log import clearLogLevels, LogLevel, setLogLevelForNamespace
 
 from twistedcaldav import caldavxml, customxml, carddavxml, mkcolxml
 from twistedcaldav.config import ConfigProvider, ConfigurationError, ConfigDict
@@ -1046,7 +1046,7 @@
         try:
             configDict = parser.parse(open(filename))
         except (IOError, OSError):
-            log.err("Configuration file does not exist or is inaccessible: %s" % (filename,))
+            log.error("Configuration file does not exist or is inaccessible: %s" % (filename,))
             raise ConfigurationError("Configuration file does not exist or is inaccessible: %s" % (filename,))
         else:
             configDict = _cleanup(configDict, self._defaults)
@@ -1388,13 +1388,13 @@
 
     try:
         if "DefaultLogLevel" in configDict:
-            level = configDict["DefaultLogLevel"]
-            if level:
-                setLogLevelForNamespace(None, level)
+            levelName = configDict["DefaultLogLevel"]
+            if levelName:
+                setLogLevelForNamespace(None, LogLevel.levelWithName(levelName))
 
         if "LogLevels" in configDict:
-            for namespace in configDict["LogLevels"]:
-                setLogLevelForNamespace(namespace, configDict["LogLevels"][namespace])
+            for namespace, levelName in configDict["LogLevels"].iteritems():
+                setLogLevelForNamespace(namespace, LogLevel.levelWithName(levelName))
 
     except InvalidLogLevelError, e:
         raise ConfigurationError("Invalid log level: %s" % (e.level))
@@ -1579,12 +1579,12 @@
         if config_key in os.environ and os.environ[config_key] == config_key_value:
             pass
         else:
-            log.err("Ignoring unknown configuration option: %r" % (key,))
+            log.error("Ignoring unknown configuration option: %r" % (key,))
             del cleanDict[key]
 
 
     def deprecated(oldKey, newKey):
-        log.err("Configuration option %r is deprecated in favor of %r." % (oldKey, newKey))
+        log.error("Configuration option %r is deprecated in favor of %r." % (oldKey, newKey))
         if oldKey in configDict and newKey in configDict:
             raise ConfigurationError(
                 "Both %r and %r options are specified; use the %r option only."

Modified: CalendarServer/trunk/twistedcaldav/storebridge.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/storebridge.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/storebridge.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -34,7 +34,6 @@
 from twisted.internet.defer import succeed, inlineCallbacks, returnValue, maybeDeferred
 from twisted.internet.protocol import Protocol
 from twisted.python.hashlib import md5
-from twisted.python.log import err as logDefaultException
 from twisted.python.util import FancyEqMixin
 
 from twistedcaldav import customxml, carddavxml, caldavxml
@@ -424,7 +423,7 @@
             msg = "illegal depth header for DELETE on collection: %s" % (
                 depth,
             )
-            log.err(msg)
+            log.error(msg)
             raise HTTPError(StatusResponse(BAD_REQUEST, msg))
         response = (yield self.storeRemove(request))
         returnValue(response)
@@ -476,7 +475,7 @@
             try:
                 yield child.storeRemove(request)
             except:
-                logDefaultException()
+                log.failure()
                 errors.add(childurl, BAD_REQUEST)
 
         # Now do normal delete
@@ -2244,7 +2243,7 @@
 
         if not destination_uri:
             msg = "No destination header in MOVE request."
-            log.err(msg)
+            log.error(msg)
             raise HTTPError(StatusResponse(BAD_REQUEST, msg))
 
         destination = (yield request.locateResource(destination_uri))
@@ -2604,7 +2603,7 @@
         # Content-type check
         content_type = request.headers.getHeader("content-type")
         if content_type is not None and (content_type.mediaType, content_type.mediaSubtype) != ("text", "calendar"):
-            log.err("MIME type %s not allowed in calendar collection" % (content_type,))
+            log.error("MIME type %s not allowed in calendar collection" % (content_type,))
             raise HTTPError(ErrorResponse(
                 responsecode.FORBIDDEN,
                 (caldav_namespace, "supported-calendar-data"),
@@ -2633,7 +2632,7 @@
             try:
                 component = Component.fromString(calendardata)
             except ValueError, e:
-                log.err(str(e))
+                log.error(str(e))
                 raise HTTPError(ErrorResponse(
                     responsecode.FORBIDDEN,
                     (caldav_namespace, "valid-calendar-data"),
@@ -2696,7 +2695,7 @@
         except Exception as err:
 
             if isinstance(err, ValueError):
-                log.err("Error while handling (calendar) PUT: %s" % (err,))
+                log.error("Error while handling (calendar) PUT: %s" % (err,))
                 raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, str(err)))
             else:
                 raise
@@ -3054,7 +3053,7 @@
         # Content-type check
         content_type = request.headers.getHeader("content-type")
         if content_type is not None and (content_type.mediaType, content_type.mediaSubtype) != ("text", "vcard"):
-            log.err("MIME type %s not allowed in vcard collection" % (content_type,))
+            log.error("MIME type %s not allowed in vcard collection" % (content_type,))
             raise HTTPError(ErrorResponse(
                 responsecode.FORBIDDEN,
                 (carddav_namespace, "supported-address-data"),
@@ -3080,7 +3079,7 @@
             try:
                 component = VCard.fromString(vcarddata)
             except ValueError, e:
-                log.err(str(e))
+                log.error(str(e))
                 raise HTTPError(ErrorResponse(
                     responsecode.FORBIDDEN,
                     (carddav_namespace, "valid-address-data"),
@@ -3145,7 +3144,7 @@
         except Exception as err:
 
             if isinstance(err, ValueError):
-                log.err("Error while handling (vCard) PUT: %s" % (err,))
+                log.error("Error while handling (vCard) PUT: %s" % (err,))
                 raise HTTPError(StatusResponse(responsecode.BAD_REQUEST, str(err)))
             else:
                 raise

Modified: CalendarServer/trunk/twistedcaldav/test/test_cache.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_cache.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/test/test_cache.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -20,11 +20,13 @@
 
 from twisted.internet.defer import succeed, maybeDeferred
 
-from txdav.xml import element as davxml
+from twext.python.log import LogLevel
 from twext.web2.dav.util import allDataFromStream
 from twext.web2.stream import MemoryStream
 from twext.web2.http_headers import Headers
 
+from txdav.xml import element as davxml
+
 from twistedcaldav.cache import MemcacheResponseCache
 from twistedcaldav.cache import MemcacheChangeNotifier
 from twistedcaldav.cache import PropfindCacheMixin
@@ -386,7 +388,7 @@
 
         memcacheStub = InMemoryMemcacheProtocol()
         self.rc = MemcacheResponseCache(None, cachePool=memcacheStub)
-        self.rc.logger.setLevel('debug')
+        self.rc.logger.setLevel(LogLevel.debug)
         self.tokens = {}
 
         self.tokens['/calendars/__uids__/cdaboo/'] = 'uriToken0'

Modified: CalendarServer/trunk/twistedcaldav/test/test_config.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/test/test_config.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/test/test_config.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -15,7 +15,7 @@
 ##
 
 from twext.python.plistlib import writePlist #@UnresolvedImport
-from twext.python.log import logLevelForNamespace
+from twext.python.log import LogLevel, logLevelForNamespace
 
 from twistedcaldav.config import config, ConfigDict, mergeData
 from twistedcaldav.resource import CalDAVResource
@@ -331,19 +331,19 @@
         config.setDefaults(DEFAULT_CONFIG)
         config.reload()
 
-        self.assertEquals(logLevelForNamespace(None), "warn")
-        self.assertEquals(logLevelForNamespace("some.namespace"), "warn")
+        self.assertEquals(logLevelForNamespace(None), LogLevel.warn)
+        self.assertEquals(logLevelForNamespace("some.namespace"), LogLevel.warn)
 
         config.load(self.testConfig)
 
-        self.assertEquals(logLevelForNamespace(None), "info")
-        self.assertEquals(logLevelForNamespace("some.namespace"), "debug")
+        self.assertEquals(logLevelForNamespace(None), LogLevel.info)
+        self.assertEquals(logLevelForNamespace("some.namespace"), LogLevel.debug)
 
         writePlist({}, self.testConfig)
         config.reload()
 
-        self.assertEquals(logLevelForNamespace(None), "warn")
-        self.assertEquals(logLevelForNamespace("some.namespace"), "warn")
+        self.assertEquals(logLevelForNamespace(None), LogLevel.warn)
+        self.assertEquals(logLevelForNamespace("some.namespace"), LogLevel.warn)
 
 
     def test_ConfigDict(self):

Modified: CalendarServer/trunk/twistedcaldav/upgrade.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/upgrade.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/twistedcaldav/upgrade.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -307,7 +307,7 @@
     errorOccurred = []
     def setError(f=None):
         if f is not None:
-            log.err(f)
+            log.error(f)
         errorOccurred.append(True)
 
 
@@ -819,7 +819,7 @@
         try:
             freeBusySet = unpickle(value)
         except UnpicklingError:
-            log.err("Invalid free/busy property value")
+            log.error("Invalid free/busy property value")
             # MOR: continue on?
             return None
 

Modified: CalendarServer/trunk/txdav/base/datastore/subpostgres.py
===================================================================
--- CalendarServer/trunk/txdav/base/datastore/subpostgres.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/base/datastore/subpostgres.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -457,7 +457,7 @@
             self.ready(*createConnection())
             self.deactivateDelayedShutdown()
         def reportit(f):
-            log.err(f)
+            log.failure(f)
             self.deactivateDelayedShutdown()
             self.reactor.stop()
         self.monitor.completionDeferred.addCallback(

Modified: CalendarServer/trunk/txdav/base/datastore/util.py
===================================================================
--- CalendarServer/trunk/txdav/base/datastore/util.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/base/datastore/util.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -136,8 +136,8 @@
         uu = UUID(normstr)
     except ValueError:
         if isURI:
-            log.msg(format="normalizing urn:uuid: without UUID: %(uid)r",
-                    uid=somestr)
+            log.info(format="normalizing urn:uuid: without UUID: %(uid)r",
+                     uid=somestr)
         # not a UUID, whatever
         return somestr
     else:

Modified: CalendarServer/trunk/txdav/caldav/datastore/index_file.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/index_file.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/caldav/datastore/index_file.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -158,7 +158,7 @@
             name_utf8 = name.encode("utf-8")
             if name is not None and self.resource.getChild(name_utf8) is None:
                 # Clean up
-                log.err("Stale resource record found for child %s with UID %s in %s" % (name, uid, self.resource))
+                log.error("Stale resource record found for child %s with UID %s in %s" % (name, uid, self.resource))
                 self._delete_from_db(name, uid, False)
                 self._db_commit()
             else:
@@ -375,8 +375,8 @@
                     del row[9]
                 results.append(row)
             else:
-                log.err("Calendar resource %s is missing from %s. Removing from index."
-                        % (name, self.resource))
+                log.error("Calendar resource %s is missing from %s. Removing from index."
+                          % (name, self.resource))
                 self.deleteResource(name)
 
         return results
@@ -398,8 +398,8 @@
             if self.resource.getChild(name.encode("utf-8")):
                 results.append(row)
             else:
-                log.err("Calendar resource %s is missing from %s. Removing from index."
-                        % (name, self.resource))
+                log.error("Calendar resource %s is missing from %s. Removing from index."
+                          % (name, self.resource))
                 self.deleteResource(name)
 
         return results
@@ -709,7 +709,7 @@
             instances = calendar.expandTimeRanges(expand, ignoreInvalidInstances=reCreate)
             recurrenceLimit = instances.limit
         except InvalidOverriddenInstanceError, e:
-            log.err("Invalid instance %s when indexing %s in %s" % (e.rid, name, self.resource,))
+            log.error("Invalid instance %s when indexing %s in %s" % (e.rid, name, self.resource,))
             raise
 
         # Now coerce indexing to off if needed
@@ -925,7 +925,7 @@
                 % (uid, self.index.resource)
             )
         except sqlite.Error, e:
-            log.err("Unable to reserve UID: %s", (e,))
+            log.error("Unable to reserve UID: %s", (e,))
             self.index._db_rollback()
             raise
 
@@ -949,7 +949,7 @@
                         "delete from RESERVED where UID = :1", uid)
                     self.index._db_commit()
                 except sqlite.Error, e:
-                    log.err("Unable to unreserve UID: %s", (e,))
+                    log.error("Unable to unreserve UID: %s", (e,))
                     self.index._db_rollback()
                     raise
 
@@ -977,7 +977,7 @@
                     self.index._db_execute("delete from RESERVED where UID = :1", uid)
                     self.index._db_commit()
                 except sqlite.Error, e:
-                    log.err("Unable to unreserve UID: %s", (e,))
+                    log.error("Unable to unreserve UID: %s", (e,))
                     self.index._db_rollback()
                     raise
                 return False
@@ -1078,7 +1078,7 @@
             try:
                 stream = fp.child(name).open()
             except (IOError, OSError), e:
-                log.err("Unable to open resource %s: %s" % (name, e))
+                log.error("Unable to open resource %s: %s" % (name, e))
                 continue
 
             # FIXME: This is blocking I/O
@@ -1087,9 +1087,9 @@
                 calendar.validCalendarData()
                 calendar.validCalendarForCalDAV(methodAllowed=False)
             except ValueError:
-                log.err("Non-calendar resource: %s" % (name,))
+                log.error("Non-calendar resource: %s" % (name,))
             else:
-                #log.msg("Indexing resource: %s" % (name,))
+                #log.info("Indexing resource: %s" % (name,))
                 self.addResource(name, calendar, True, reCreate=True)
             finally:
                 stream.close()
@@ -1190,7 +1190,7 @@
             try:
                 stream = fp.child(name).open()
             except (IOError, OSError), e:
-                log.err("Unable to open resource %s: %s" % (name, e))
+                log.error("Unable to open resource %s: %s" % (name, e))
                 continue
 
             # FIXME: This is blocking I/O
@@ -1199,9 +1199,9 @@
                 calendar.validCalendarData()
                 calendar.validCalendarForCalDAV(methodAllowed=True)
             except ValueError:
-                log.err("Non-calendar resource: %s" % (name,))
+                log.error("Non-calendar resource: %s" % (name,))
             else:
-                #log.msg("Indexing resource: %s" % (name,))
+                #log.info("Indexing resource: %s" % (name,))
                 self.addResource(name, calendar, True, reCreate=True)
             finally:
                 stream.close()

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/delivery.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/delivery.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/delivery.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -14,7 +14,7 @@
 # limitations under the License.
 ##
 
-from twext.python.log import Logger
+from twext.python.log import Logger, LogLevel
 from twext.web2.dav.http import ErrorResponse
 
 from twisted.internet.defer import inlineCallbacks, returnValue, succeed
@@ -136,8 +136,8 @@
                 noAttendeeRefresh=self.scheduler.noAttendeeRefresh,
             ))
         except ImplicitProcessorException, e:
-            log.err("Could not store data in Inbox : %s" % (recipient.inbox,))
-            if log.willLogAtLevel("debug"):
+            log.error("Could not store data in Inbox : %s" % (recipient.inbox,))
+            if log.willLogAtLevel(LogLevel.debug):
                 log.debug("%s: %s" % (e, Failure().getTraceback(),))
             err = HTTPError(ErrorResponse(
                 responsecode.FORBIDDEN,
@@ -153,8 +153,8 @@
                 child = yield recipient.inbox._createCalendarObjectWithNameInternal(name, self.scheduler.calendar, ComponentUpdateState.INBOX)
             except Exception as e:
                 # FIXME: Bare except
-                log.err("Could not store data in Inbox : %s %s" % (recipient.inbox, e,))
-                if log.willLogAtLevel("debug"):
+                log.error("Could not store data in Inbox : %s %s" % (recipient.inbox, e,))
+                if log.willLogAtLevel(LogLevel.debug):
                     log.debug("Bare Exception: %s" % (Failure().getTraceback(),))
                 err = HTTPError(ErrorResponse(
                     responsecode.FORBIDDEN,
@@ -196,8 +196,8 @@
                 event_details,
             ))
         except:
-            log.err("Could not determine free busy information: %s" % (recipient.cuaddr,))
-            if log.willLogAtLevel("debug"):
+            log.error("Could not determine free busy information: %s" % (recipient.cuaddr,))
+            if log.willLogAtLevel(LogLevel.debug):
                 log.debug("Bare Exception: %s" % (Failure().getTraceback(),))
             err = HTTPError(ErrorResponse(
                 responsecode.FORBIDDEN,

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/scheduler.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/scheduler.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/caldav/scheduler.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -77,7 +77,7 @@
     def checkAuthorization(self):
         # Must have an authenticated user
         if not self.internal_request and self.originator_uid == None:
-            log.err("Unauthenticated originators not allowed: %s" % (self.originator,))
+            log.error("Unauthenticated originators not allowed: %s" % (self.originator,))
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["originator-denied"],
@@ -94,7 +94,7 @@
         originatorPrincipal = self.txn.directoryService().recordWithCalendarUserAddress(self.originator)
         if originatorPrincipal is None:
             # Local requests MUST have a principal.
-            log.err("Could not find principal for originator: %s" % (self.originator,))
+            log.error("Could not find principal for originator: %s" % (self.originator,))
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["originator-denied"],
@@ -122,7 +122,7 @@
             if principal is None:
                 address = (yield addressmapping.mapper.getCalendarUser(recipient, principal))
                 if isinstance(address, InvalidCalendarUser):
-                    log.err("Unknown calendar user address: %s" % (recipient,))
+                    log.error("Unknown calendar user address: %s" % (recipient,))
                 results.append(address)
             else:
                 # Map recipient to their inbox
@@ -138,7 +138,7 @@
                 if inbox:
                     results.append(calendarUserFromPrincipal(recipient, principal, inbox))
                 else:
-                    log.err("No schedule inbox for principal: %s" % (principal,))
+                    log.error("No schedule inbox for principal: %s" % (principal,))
                     results.append(InvalidCalendarUser(recipient))
 
         self.recipients = results
@@ -161,7 +161,7 @@
                     # to be handled later when we know whether a new invite is being added
                     # (which we reject) vs an update to an existing one (which we allow).
                     if self.checkForFreeBusy() and not organizerPrincipal.enabledAsOrganizer():
-                        log.err("ORGANIZER not allowed to be an Organizer: %s" % (self.calendar,))
+                        log.error("ORGANIZER not allowed to be an Organizer: %s" % (self.calendar,))
                         raise HTTPError(self.errorResponse(
                             responsecode.FORBIDDEN,
                             self.errorElements["organizer-denied"],
@@ -170,7 +170,7 @@
 
                     self.organizer = LocalCalendarUser(organizer, organizerPrincipal)
                 else:
-                    log.err("No outbox for ORGANIZER in calendar data: %s" % (self.calendar,))
+                    log.error("No outbox for ORGANIZER in calendar data: %s" % (self.calendar,))
                     raise HTTPError(self.errorResponse(
                         responsecode.FORBIDDEN,
                         self.errorElements["organizer-denied"],
@@ -179,7 +179,7 @@
             else:
                 localUser = (yield addressmapping.mapper.isCalendarUserInMyDomain(organizer))
                 if localUser:
-                    log.err("No principal for ORGANIZER in calendar data: %s" % (self.calendar,))
+                    log.error("No principal for ORGANIZER in calendar data: %s" % (self.calendar,))
                     raise HTTPError(self.errorResponse(
                         responsecode.FORBIDDEN,
                         self.errorElements["organizer-denied"],
@@ -188,7 +188,7 @@
                 else:
                     self.organizer = RemoteCalendarUser(organizer)
         else:
-            log.err("ORGANIZER missing in calendar data: %s" % (self.calendar,))
+            log.error("ORGANIZER missing in calendar data: %s" % (self.calendar,))
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["invalid-scheduling-message"],
@@ -200,7 +200,7 @@
 
         # Make sure that the ORGANIZER is local
         if not isinstance(self.organizer, LocalCalendarUser):
-            log.err("ORGANIZER is not local to server in calendar data: %s" % (self.calendar,))
+            log.error("ORGANIZER is not local to server in calendar data: %s" % (self.calendar,))
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["organizer-denied"],
@@ -209,7 +209,7 @@
 
         # Make sure that the ORGANIZER's Outbox is the request URI
         if self.doingPOST is not None and self.organizer.principal.uid != self.originator_uid:
-            log.err("Wrong outbox for ORGANIZER in calendar data: %s" % (self.calendar,))
+            log.error("Wrong outbox for ORGANIZER in calendar data: %s" % (self.calendar,))
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["organizer-denied"],
@@ -227,14 +227,14 @@
         attendeePrincipal = self.txn.directoryService().recordWithCalendarUserAddress(self.attendee)
         if attendeePrincipal:
             if self.doingPOST is not None and attendeePrincipal.uid != self.originator_uid:
-                log.err("ATTENDEE in calendar data does not match owner of Outbox: %s" % (self.calendar,))
+                log.error("ATTENDEE in calendar data does not match owner of Outbox: %s" % (self.calendar,))
                 raise HTTPError(self.errorResponse(
                     responsecode.FORBIDDEN,
                     self.errorElements["attendee-denied"],
                     "Outbox does not belong to attendee",
                 ))
         else:
-            log.err("Unknown ATTENDEE in calendar data: %s" % (self.calendar,))
+            log.error("Unknown ATTENDEE in calendar data: %s" % (self.calendar,))
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["attendee-denied"],

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/freebusy.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/freebusy.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/freebusy.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -298,7 +298,7 @@
             # between our initial index query and getting here. For now we will ignore this error, but in
             # the longer term we need to implement some form of locking, perhaps.
             if calendar is None:
-                log.err("Calendar %s is missing from calendar collection %r" % (name, calresource))
+                log.error("Calendar %s is missing from calendar collection %r" % (name, calresource))
                 continue
 
             # Ignore ones of this UID

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/icaldiff.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -476,7 +476,7 @@
 
         # Possible case where one ATTENDEE prop is missing - this happens with a "fake" master sometimes
         if serverAttendee is None or clientAttendee is None:
-            log.err("ATTENDEE for user making an attendee change is missing: %s" % (self.attendee,))
+            log.error("ATTENDEE for user making an attendee change is missing: %s" % (self.attendee,))
             return False, False
 
         if serverAttendee.parameterValue("PARTSTAT", "NEEDS-ACTION") != clientAttendee.parameterValue("PARTSTAT", "NEEDS-ACTION"):
@@ -667,7 +667,7 @@
 
         # Possible case where ATTENDEE prop is missing - this happens with a "fake" master sometimes
         if attendee is None:
-            log.err("ATTENDEE for user making an attendee change is missing: %s" % (self.attendee,))
+            log.error("ATTENDEE for user making an attendee change is missing: %s" % (self.attendee,))
             return False
 
         partstatChanged = attendee.parameterValue("PARTSTAT", "NEEDS-ACTION") != "DECLINED"
@@ -813,4 +813,4 @@
             loggedUID = "Unknown"
         loggedName = accounting.emitAccounting("Implicit Errors", loggedUID, logstr)
         if loggedName:
-            log.err("Generating Implicit Error accounting at path: %s" % (loggedName,))
+            log.error("Generating Implicit Error accounting at path: %s" % (loggedName,))

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/implicit.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -240,7 +240,7 @@
         # to create new scheduling resources.
         if self.action == "create":
             if self.organizerPrincipal and not self.organizerPrincipal.enabledAsOrganizer():
-                log.err("ORGANIZER not allowed to be an Organizer: %s" % (self.organizer,))
+                log.error("ORGANIZER not allowed to be an Organizer: %s" % (self.organizer,))
                 raise HTTPError(ErrorResponse(
                     responsecode.FORBIDDEN,
                     (caldav_namespace, "organizer-allowed"),

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/delivery.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/delivery.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/delivery.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -267,7 +267,7 @@
 
         except Exception, e:
             # Generated failed responses for each recipient
-            log.err("Could not do server-to-server request : %s %s" % (self, e))
+            log.error("Could not do server-to-server request : %s %s" % (self, e))
             for recipient in self.recipients:
                 err = HTTPError(ErrorResponse(
                     responsecode.FORBIDDEN,

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/scheduler.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/scheduler.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/ischedule/scheduler.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -205,7 +205,7 @@
     def checkAuthorization(self):
         # Must have an unauthenticated user
         if self.originator_uid is not None:
-            log.err("Authenticated originators not allowed: %s" % (self.originator_uid,))
+            log.error("Authenticated originators not allowed: %s" % (self.originator_uid,))
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["originator-denied"],
@@ -224,7 +224,7 @@
         localUser = (yield addressmapping.mapper.isCalendarUserInMyDomain(self.originator))
         if originatorPrincipal or localUser:
             if originatorPrincipal.locallyHosted():
-                log.err("Cannot use originator that is on this server: %s" % (self.originator,))
+                log.error("Cannot use originator that is on this server: %s" % (self.originator,))
                 raise HTTPError(self.errorResponse(
                     responsecode.FORBIDDEN,
                     self.errorElements["originator-denied"],
@@ -251,7 +251,7 @@
         servermgr = IScheduleServers()
         server = servermgr.mapDomain(self.originator.domain)
         if not server or not server.allow_from:
-            log.err("Originator not on recognized server: %s" % (self.originator,))
+            log.error("Originator not on recognized server: %s" % (self.originator,))
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["originator-denied"],
@@ -291,7 +291,7 @@
                     log.debug("iSchedule cannot lookup client ip '%s': %s" % (clientip, str(e),))
 
             if not matched:
-                log.err("Originator not on allowed server: %s" % (self.originator,))
+                log.error("Originator not on allowed server: %s" % (self.originator,))
                 raise HTTPError(self.errorResponse(
                     responsecode.FORBIDDEN,
                     self.errorElements["originator-denied"],
@@ -346,11 +346,11 @@
 
         # Check possible shared secret
         if matched and not Servers.getThisServer().checkSharedSecret(self.request):
-            log.err("Invalid iSchedule shared secret")
+            log.error("Invalid iSchedule shared secret")
             matched = False
 
         if not matched:
-            log.err("Originator not on allowed server: %s" % (self.originator,))
+            log.error("Originator not on allowed server: %s" % (self.originator,))
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["originator-denied"],
@@ -370,7 +370,7 @@
             organizerPrincipal = self.txn.directoryService().recordWithCalendarUserAddress(organizer)
             if organizerPrincipal:
                 if organizerPrincipal.locallyHosted():
-                    log.err("Invalid ORGANIZER in calendar data: %s" % (self.calendar,))
+                    log.error("Invalid ORGANIZER in calendar data: %s" % (self.calendar,))
                     raise HTTPError(self.errorResponse(
                         responsecode.FORBIDDEN,
                         self.errorElements["organizer-denied"],
@@ -383,7 +383,7 @@
             else:
                 localUser = (yield addressmapping.mapper.isCalendarUserInMyDomain(organizer))
                 if localUser:
-                    log.err("Unsupported ORGANIZER in calendar data: %s" % (self.calendar,))
+                    log.error("Unsupported ORGANIZER in calendar data: %s" % (self.calendar,))
                     raise HTTPError(self.errorResponse(
                         responsecode.FORBIDDEN,
                         self.errorElements["organizer-denied"],
@@ -392,7 +392,7 @@
                 else:
                     self.organizer = RemoteCalendarUser(organizer)
         else:
-            log.err("ORGANIZER missing in calendar data: %s" % (self.calendar,))
+            log.error("ORGANIZER missing in calendar data: %s" % (self.calendar,))
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["organizer-denied"],
@@ -411,7 +411,7 @@
         attendeePrincipal = self.txn.directoryService().recordWithCalendarUserAddress(self.attendee)
         if attendeePrincipal:
             if attendeePrincipal.locallyHosted():
-                log.err("Invalid ATTENDEE in calendar data: %s" % (self.calendar,))
+                log.error("Invalid ATTENDEE in calendar data: %s" % (self.calendar,))
                 raise HTTPError(self.errorResponse(
                     responsecode.FORBIDDEN,
                     self.errorElements["attendee-denied"],
@@ -422,7 +422,7 @@
         else:
             localUser = (yield addressmapping.mapper.isCalendarUserInMyDomain(self.attendee))
             if localUser:
-                log.err("Unknown ATTENDEE in calendar data: %s" % (self.calendar,))
+                log.error("Unknown ATTENDEE in calendar data: %s" % (self.calendar,))
                 raise HTTPError(self.errorResponse(
                     responsecode.FORBIDDEN,
                     self.errorElements["attendee-denied"],
@@ -447,7 +447,7 @@
             yield self.checkAttendeeAsOriginator()
 
         else:
-            log.err("Unknown iTIP METHOD for security checks: %s" % (self.calendar.propertyValue("METHOD"),))
+            log.error("Unknown iTIP METHOD for security checks: %s" % (self.calendar.propertyValue("METHOD"),))
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["invalid-scheduling-message"],

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/processing.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -24,7 +24,6 @@
 
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks, returnValue
-from twisted.python.log import err as log_traceback
 
 from twistedcaldav import customxml, caldavxml
 from twistedcaldav.caldavxml import caldav_namespace
@@ -118,7 +117,7 @@
                 # We attempt to recover from this. That involves trying to re-write the attendee data
                 # to match that of the organizer assuming we have the organizer's full data available, then
                 # we try the processing operation again.
-                log_traceback()
+                log.failure()
                 log.error("ImplicitProcessing - originator '%s' to recipient '%s' with UID: '%s' - exception raised will try to fix: %s" % (self.originator.cuaddr, self.recipient.cuaddr, self.uid, e))
                 result = (yield self.doImplicitAttendeeEventFix(e))
                 if result:
@@ -126,7 +125,7 @@
                     try:
                         result = (yield self.doImplicitAttendee())
                     except Exception, e:
-                        log_traceback()
+                        log.failure()
                         log.error("ImplicitProcessing - originator '%s' to recipient '%s' with UID: '%s' - exception raised after fix: %s" % (self.originator.cuaddr, self.recipient.cuaddr, self.uid, e))
                         raise ImplicitProcessorException("5.1;Service unavailable")
                 else:

Modified: CalendarServer/trunk/txdav/caldav/datastore/scheduling/scheduler.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/scheduling/scheduler.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/caldav/datastore/scheduling/scheduler.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -246,7 +246,7 @@
         originator = originatorPrincipal.canonicalCalendarUserAddress() if originatorPrincipal else ""
 
         if not originator:
-            log.err("%s request must have Originator" % (self.method,))
+            log.error("%s request must have Originator" % (self.method,))
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["originator-missing"],
@@ -267,7 +267,7 @@
                 unique_set.add(attendee)
 
         if not attendees:
-            log.err("%s request must have at least one Recipient" % (self.method,))
+            log.error("%s request must have at least one Recipient" % (self.method,))
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["recipient-missing"],
@@ -319,7 +319,7 @@
             try:
                 self.calendar.validCalendarData()
             except ValueError, e:
-                log.err("%s request calendar component is not valid:%s %s" % (self.method, e, self.calendar,))
+                log.error("%s request calendar component is not valid:%s %s" % (self.method, e, self.calendar,))
                 raise HTTPError(self.errorResponse(
                     responsecode.FORBIDDEN,
                     self.errorElements["invalid-calendar-data"],
@@ -328,7 +328,7 @@
 
             # Must have a METHOD
             if not self.calendar.isValidMethod():
-                log.err("%s request must have valid METHOD property in calendar component: %s" % (self.method, self.calendar,))
+                log.error("%s request must have valid METHOD property in calendar component: %s" % (self.method, self.calendar,))
                 raise HTTPError(self.errorResponse(
                     responsecode.FORBIDDEN,
                     self.errorElements["invalid-scheduling-message"],
@@ -337,7 +337,7 @@
 
             # Verify iTIP behavior
             if not self.calendar.isValidITIP():
-                log.err("%s request must have a calendar component that satisfies iTIP requirements: %s" % (self.method, self.calendar,))
+                log.error("%s request must have a calendar component that satisfies iTIP requirements: %s" % (self.method, self.calendar,))
                 raise HTTPError(self.errorResponse(
                     responsecode.FORBIDDEN,
                     self.errorElements["invalid-scheduling-message"],
@@ -346,7 +346,7 @@
 
             # X-CALENDARSERVER-ACCESS is not allowed in Outbox POSTs
             if self.calendar.hasProperty(Component.ACCESS_PROPERTY):
-                log.err("X-CALENDARSERVER-ACCESS not allowed in a calendar component %s request: %s" % (self.method, self.calendar,))
+                log.error("X-CALENDARSERVER-ACCESS not allowed in a calendar component %s request: %s" % (self.method, self.calendar,))
                 raise HTTPError(self.errorResponse(
                     responsecode.FORBIDDEN,
                     (calendarserver_namespace, "no-access-restrictions"),
@@ -365,7 +365,7 @@
 
             # Must have only one
             if len(attendees) != 1:
-                log.err("Wrong number of ATTENDEEs in calendar data: %s" % (str(self.calendar),))
+                log.error("Wrong number of ATTENDEEs in calendar data: %s" % (str(self.calendar),))
                 raise HTTPError(self.errorResponse(
                     responsecode.FORBIDDEN,
                     self.errorElements["invalid-scheduling-message"],
@@ -375,7 +375,7 @@
 
         else:
             msg = "Unknown iTIP METHOD: %s" % (self.calendar.propertyValue("METHOD"),)
-            log.err(msg)
+            log.error(msg)
             raise HTTPError(self.errorResponse(
                 responsecode.FORBIDDEN,
                 self.errorElements["invalid-scheduling-message"],
@@ -389,7 +389,7 @@
                 # Extract time range from VFREEBUSY object
                 vfreebusies = [v for v in self.calendar.subcomponents() if v.name() == "VFREEBUSY"]
                 if len(vfreebusies) != 1:
-                    log.err("iTIP data is not valid for a VFREEBUSY request: %s" % (self.calendar,))
+                    log.error("iTIP data is not valid for a VFREEBUSY request: %s" % (self.calendar,))
                     raise HTTPError(self.errorResponse(
                         responsecode.FORBIDDEN,
                         self.errorElements["invalid-scheduling-message"],
@@ -398,7 +398,7 @@
                 dtstart = vfreebusies[0].getStartDateUTC()
                 dtend = vfreebusies[0].getEndDateUTC()
                 if dtstart is None or dtend is None:
-                    log.err("VFREEBUSY start/end not valid: %s" % (self.calendar,))
+                    log.error("VFREEBUSY start/end not valid: %s" % (self.calendar,))
                     raise HTTPError(self.errorResponse(
                         responsecode.FORBIDDEN,
                         self.errorElements["invalid-scheduling-message"],
@@ -407,7 +407,7 @@
 
                 # Some clients send floating instead of UTC - coerce to UTC
                 if not dtstart.utc() or not dtend.utc():
-                    log.err("VFREEBUSY start or end not UTC: %s" % (self.calendar,))
+                    log.error("VFREEBUSY start or end not UTC: %s" % (self.calendar,))
                     raise HTTPError(self.errorResponse(
                         responsecode.FORBIDDEN,
                         self.errorElements["invalid-scheduling-message"],
@@ -605,9 +605,9 @@
             if principal is None:
                 localUser = (yield addressmapping.mapper.isCalendarUserInMyDomain(recipient))
                 if localUser:
-                    log.err("No principal for calendar user address: %s" % (recipient,))
+                    log.error("No principal for calendar user address: %s" % (recipient,))
                 else:
-                    log.err("Unknown calendar user address: %s" % (recipient,))
+                    log.error("Unknown calendar user address: %s" % (recipient,))
                 results.append(InvalidCalendarUser(recipient))
             else:
                 # Map recipient to their inbox
@@ -623,7 +623,7 @@
                 if inbox:
                     results.append(calendarUserFromPrincipal(recipient, principal, inbox))
                 else:
-                    log.err("No schedule inbox for principal: %s" % (principal,))
+                    log.error("No schedule inbox for principal: %s" % (principal,))
                     results.append(InvalidCalendarUser(recipient))
 
         self.recipients = results

Modified: CalendarServer/trunk/txdav/caldav/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/sql.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/caldav/datastore/sql.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -1851,7 +1851,7 @@
         try:
             component = PerUserDataFilter(accessUID).merge(component.duplicate(), oldCal)
         except ValueError:
-            log.err("Invalid per-user data merge")
+            log.error("Invalid per-user data merge")
             raise InvalidPerUserDataMerge("Cannot merge per-user data")
 
         returnValue(component)
@@ -1986,7 +1986,7 @@
 
                 else:
                     msg = "Invalid return status code from ImplicitScheduler: %s" % (implicit_result,)
-                    log.err(msg)
+                    log.error(msg)
                     raise InvalidObjectResourceError(msg)
             else:
                 self.isScheduleObject, new_component, did_implicit_action = implicit_result

Modified: CalendarServer/trunk/txdav/caldav/datastore/util.py
===================================================================
--- CalendarServer/trunk/txdav/caldav/datastore/util.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/caldav/datastore/util.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -668,8 +668,10 @@
                 if fixCount:
                     yield calObj.setComponent(comp)
             except:
-                log.err(Failure(),
-                        'Error while processing calendar/object %r %r' % (
-                            calendar.name(), calObj.name()
-                        ))
+                log.failure(
+                    format = "Error while processing calendar/object %(calendarName)r %(calendarObject)r",
+                    failure = Failure(),
+                    calendarName = calendar.name(),
+                    calendarObject = calObj.name(),
+                )
     returnValue(fixedThisHome)

Modified: CalendarServer/trunk/txdav/carddav/datastore/index_file.py
===================================================================
--- CalendarServer/trunk/txdav/carddav/datastore/index_file.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/carddav/datastore/index_file.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -153,7 +153,7 @@
                 % (uid, self.index.resource)
             )
         except sqlite.Error, e:
-            log.err("Unable to reserve UID: %s", (e,))
+            log.error("Unable to reserve UID: %s", (e,))
             self.index._db_rollback()
             raise
 
@@ -177,7 +177,7 @@
                         "delete from RESERVED where UID = :1", uid)
                     self.index._db_commit()
                 except sqlite.Error, e:
-                    log.err("Unable to unreserve UID: %s", (e,))
+                    log.error("Unable to unreserve UID: %s", (e,))
                     self.index._db_rollback()
                     raise
 
@@ -205,7 +205,7 @@
                     self.index._db_execute("delete from RESERVED where UID = :1", uid)
                     self.index._db_commit()
                 except sqlite.Error, e:
-                    log.err("Unable to unreserve UID: %s", (e,))
+                    log.error("Unable to unreserve UID: %s", (e,))
                     self.index._db_rollback()
                     raise
                 return False
@@ -308,7 +308,7 @@
             name_utf8 = name.encode("utf-8")
             if name is not None and self.resource.getChild(name_utf8) is None:
                 # Clean up
-                log.err("Stale resource record found for child %s with UID %s in %s" % (name, uid, self.resource))
+                log.error("Stale resource record found for child %s with UID %s in %s" % (name, uid, self.resource))
                 self._delete_from_db(name, uid, False)
                 self._db_commit()
             else:
@@ -478,8 +478,8 @@
             if self.resource.getChild(name.encode("utf-8")):
                 yield row
             else:
-                log.err("vCard resource %s is missing from %s. Removing from index."
-                        % (name, self.resource))
+                log.error("vCard resource %s is missing from %s. Removing from index."
+                          % (name, self.resource))
                 self.deleteResource(name, None)
 
 
@@ -498,8 +498,8 @@
             if self.resource.getChild(name.encode("utf-8")):
                 yield row
             else:
-                log.err("AddressBook resource %s is missing from %s. Removing from index."
-                        % (name, self.resource))
+                log.error("AddressBook resource %s is missing from %s. Removing from index."
+                          % (name, self.resource))
                 self.deleteResource(name)
 
 
@@ -612,7 +612,7 @@
             try:
                 stream = fp.child(name).open()
             except (IOError, OSError), e:
-                log.err("Unable to open resource %s: %s" % (name, e))
+                log.error("Unable to open resource %s: %s" % (name, e))
                 continue
 
             try:
@@ -622,9 +622,9 @@
                     vcard.validVCardData()
                     vcard.validForCardDAV()
                 except ValueError:
-                    log.err("Non-addressbook resource: %s" % (name,))
+                    log.error("Non-addressbook resource: %s" % (name,))
                 else:
-                    #log.msg("Indexing resource: %s" % (name,))
+                    #log.info("Indexing resource: %s" % (name,))
                     self.addResource(name, vcard, True)
             finally:
                 stream.close()

Modified: CalendarServer/trunk/txdav/common/datastore/sql.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/sql.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/common/datastore/sql.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -32,7 +32,6 @@
 from zope.interface import implements, directlyProvides
 
 from twext.python.log import Logger, LoggingMixIn
-from twisted.python.log import msg as log_msg, err as log_err
 
 from txdav.xml.parser import WebDAVDocument
 from twext.web2.http_headers import MimeType
@@ -949,7 +948,7 @@
             for f in failuresToMaybeLog:
                 # TODO: direct tests, to make sure error logging
                 # happens correctly in all cases.
-                log.err(f)
+                log.error(f)
             raise AllRetriesFailed()
         triesLeft = retries
         try:
@@ -5384,7 +5383,7 @@
                                   total - n)
         else:
             estimate = "unknown"
-        log_msg(
+        log.info(
             format="Scanning UID %(uid)s [%(homeType)s] "
             "(%(pct)0.2d%%, %(estimate)s seconds remaining)...",
             uid=UID, pct=(n / float(total)) * 100, estimate=estimate,
@@ -5398,8 +5397,8 @@
             fixedThisHome = 0
         fixedOtherHome = 0
         if this is None:
-            log_msg(format="%(uid)r appears to be missing, already processed",
-                    uid=UID)
+            log.info(format="%(uid)r appears to be missing, already processed",
+                     uid=UID)
         try:
             uuidobj = UUID(UID)
         except ValueError:
@@ -5407,9 +5406,9 @@
         else:
             newname = str(uuidobj).upper()
             if UID != newname:
-                log_msg(format="Detected case variance: %(uid)s %(newuid)s"
-                        "[%(homeType)s]",
-                        uid=UID, newuid=newname, homeType=homeTypeName)
+                log.info(format="Detected case variance: %(uid)s %(newuid)s"
+                         "[%(homeType)s]",
+                         uid=UID, newuid=newname, homeType=homeTypeName)
                 other = yield _getHome(t, homeType, newname)
                 if other is None:
                     # No duplicate: just fix the name.
@@ -5424,10 +5423,10 @@
         end = time.time()
         elapsed = end - start
         allElapsed.append(elapsed)
-        log_msg(format="Scanned UID %(uid)s; %(elapsed)s seconds elapsed,"
-                " %(fixes)s properties fixed (%(duplicate)s fixes in "
-                "duplicate).", uid=UID, elapsed=elapsed, fixes=fixedThisHome,
-                duplicate=fixedOtherHome)
+        log.info(format="Scanned UID %(uid)s; %(elapsed)s seconds elapsed,"
+                 " %(fixes)s properties fixed (%(duplicate)s fixes in "
+                 "duplicate).", uid=UID, elapsed=elapsed, fixes=fixedThisHome,
+                 duplicate=fixedOtherHome)
     returnValue(None)
 
 
@@ -5541,8 +5540,8 @@
     # early-out and avoid the tedious and potentially expensive inspection of
     # oodles of calendar data.
     if not (yield _needsNormalizationUpgrade(t)):
-        log.msg("No potentially denormalized UUIDs detected, "
-                "skipping normalization upgrade.")
+        log.info("No potentially denormalized UUIDs detected, "
+                 "skipping normalization upgrade.")
         yield t.abort()
         returnValue(None)
     try:
@@ -5552,7 +5551,7 @@
         yield _normalizeColumnUUIDs(t, schema.RESOURCE_PROPERTY.VIEWER_UID)
         yield _normalizeColumnUUIDs(t, schema.APN_SUBSCRIPTIONS.SUBSCRIBER_GUID)
     except:
-        log_err()
+        log.failure()
         yield t.abort()
         # There's a lot of possible problems here which are very hard to test
         # for individually; unexpected data that might cause constraint

Modified: CalendarServer/trunk/txdav/common/datastore/test/util.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/test/util.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/common/datastore/test/util.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -25,6 +25,7 @@
 from txdav.common.idirectoryservice import IStoreDirectoryService, \
     IStoreDirectoryRecord
 
+# FIXME: Don't import from calendarserver in txdav
 from calendarserver.push.notifier import Notifier
 
 from hashlib import md5
@@ -33,10 +34,11 @@
 
 from random import Random
 
+from twext.python.log import Logger
+from twext.python.filepath import CachingFilePath
+from twext.python.vcomponent import VComponent
 from twext.enterprise.adbapi2 import ConnectionPool
 from twext.enterprise.ienterprise import AlreadyFinishedError
-from twext.python.filepath import CachingFilePath
-from twext.python.vcomponent import VComponent
 from twext.web2.dav.resource import TwistedGETContentMD5
 
 from twisted.application.service import Service
@@ -44,7 +46,6 @@
 from twisted.internet.defer import Deferred, inlineCallbacks
 from twisted.internet.defer import returnValue
 from twisted.internet.task import deferLater
-from twisted.python import log
 from twisted.trial.unittest import TestCase
 
 from twistedcaldav.config import config
@@ -65,8 +66,14 @@
 
 import gc
 
+
+
+log = Logger()
+
 md5key = PropertyName.fromElement(TwistedGETContentMD5)
 
+
+
 def allInstancesOf(cls):
     """
     Use L{gc.get_referrers} to retrieve all instances of a given class.
@@ -198,7 +205,7 @@
             self.sharedService = self.createService(getReady)
             self.sharedService.startService()
             def startStopping():
-                log.msg("Starting stopping.")
+                log.info("Starting stopping.")
                 self.sharedService.unpauseMonitor()
                 return self.sharedService.stopService()
             reactor.addSystemEventTrigger(#@UndefinedVariable
@@ -282,7 +289,7 @@
             try:
                 yield cleanupTxn.execSQL("delete from " + table, [])
             except:
-                log.err()
+                log.failure()
         yield cleanupTxn.commit()
 
         # Deal with memcached items that must be cleared

Modified: CalendarServer/trunk/txdav/xml/base.py
===================================================================
--- CalendarServer/trunk/txdav/xml/base.py	2013-05-24 01:31:34 UTC (rev 11241)
+++ CalendarServer/trunk/txdav/xml/base.py	2013-05-24 18:05:29 UTC (rev 11242)
@@ -372,7 +372,7 @@
                 try:
                     child.addToDOM(document, element)
                 except:
-                    log.err("Unable to add child %r of element %s to DOM" % (child, self))
+                    log.error("Unable to add child %r of element %s to DOM" % (child, self))
                     raise
 
     def childrenOfType(self, child_type):
@@ -478,7 +478,7 @@
         try:
             parent.appendChild(self.element(document))
         except TypeError:
-            log.err("Invalid PCDATA: %r" % (self.data,))
+            log.error("Invalid PCDATA: %r" % (self.data,))
             raise
 
     def _writeToStream(self, output, ns, level, pretty):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130524/1caf0fd4/attachment-0001.html>


More information about the calendarserver-changes mailing list