[CalendarServer-changes] [5487] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 16 13:46:24 PDT 2010


Revision: 5487
          http://trac.macosforge.org/projects/calendarserver/changeset/5487
Author:   sagen at apple.com
Date:     2010-04-16 13:46:18 -0700 (Fri, 16 Apr 2010)
Log Message:
-----------
calendarserver_manage_principals now ignores the log level set in the plist; it now defaults to "error" but adds a command line arg for setting to "debug".

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/principals.py
    CalendarServer/trunk/doc/calendarserver_manage_principals.8

Modified: CalendarServer/trunk/calendarserver/tools/principals.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/principals.py	2010-04-16 19:52:34 UTC (rev 5486)
+++ CalendarServer/trunk/calendarserver/tools/principals.py	2010-04-16 20:46:18 UTC (rev 5487)
@@ -29,7 +29,7 @@
 from twisted.internet.defer import inlineCallbacks
 from twext.web2.dav import davxml
 
-from twext.python.log import setLogLevelForNamespace
+from twext.python.log import setLogLevelForNamespace, clearLogLevels
 from twext.python.log import StandardIOObserver
 from twext.web2.dav.davxml import sname2qname, qname2sname
 
@@ -63,6 +63,7 @@
     print "options:"
     print "  -h --help: print this help and exit"
     print "  -f --config <path>: Specify caldavd.plist configuration path"
+    print "  -v --verbose: print debugging information"
     print ""
     print "actions:"
     print "  --search <search-string>: search for matching principals"
@@ -88,7 +89,7 @@
 def main():
     try:
         (optargs, args) = getopt(
-            sys.argv[1:], "a:hf:P:", [
+            sys.argv[1:], "a:hf:P:v", [
                 "help",
                 "config=",
                 "add=",
@@ -105,6 +106,7 @@
                 "remove-proxy=",
                 "set-auto-schedule=",
                 "get-auto-schedule",
+                "verbose",
             ],
         )
     except GetoptError, e:
@@ -119,11 +121,15 @@
     listPrincipals = None
     searchPrincipals = None
     principalActions = []
+    verbose = False
 
     for opt, arg in optargs:
         if opt in ("-h", "--help"):
             usage()
 
+        elif opt in ("-v", "--verbose"):
+            verbose = True
+
         elif opt in ("-f", "--config"):
             configFileName = arg
 
@@ -200,8 +206,13 @@
     #
     try:
         loadConfig(configFileName)
-        setLogLevelForNamespace(None, "warn")
 
+        # Do this first, because modifying the config object will cause
+        # some logging activity at whatever log level the plist says
+        clearLogLevels()
+
+        config.DefaultLogLevel = "debug" if verbose else "error"
+
         #
         # Send logging output to stdout
         #

Modified: CalendarServer/trunk/doc/calendarserver_manage_principals.8
===================================================================
--- CalendarServer/trunk/doc/calendarserver_manage_principals.8	2010-04-16 19:52:34 UTC (rev 5486)
+++ CalendarServer/trunk/doc/calendarserver_manage_principals.8	2010-04-16 20:46:18 UTC (rev 5487)
@@ -23,6 +23,7 @@
 .Sh SYNOPSIS
 .Nm
 .Op Fl -config Ar file
+.Op Fl -verbose
 .Op Fl -read-property Ar property
 .Op Fl -list-principal-types
 .Op Fl -list-principals Ar type
@@ -76,6 +77,8 @@
 .Bl -tag -width flag
 .It Fl h, -help
 Displays usage information
+.It Fl v, -verbose
+Displays debugging information
 .It Fl f, -config Ar FILE
 Use the Calendar Server configuration specified in the given file.  Defaults to /etc/caldavd/caldavd.plist.
 .El
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100416/b4993279/attachment.html>


More information about the calendarserver-changes mailing list