src/parasol/paraNode/paraNode.c 1.83

1.83 2010/01/12 09:09:15 markd
add option to set minimum log level, move some logging to debug
Index: src/parasol/paraNode/paraNode.c
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/parasol/paraNode/paraNode.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -b -B -U 4 -r1.82 -r1.83
--- src/parasol/paraNode/paraNode.c	21 Nov 2009 01:07:58 -0000	1.82
+++ src/parasol/paraNode/paraNode.c	12 Jan 2010 09:09:15 -0000	1.83
@@ -20,8 +20,9 @@
 
 /* command line option specifications */
 static struct optionSpec optionSpecs[] = {
     {"logFacility", OPTION_STRING},
+    {"logMinPriority", OPTION_STRING},
     {"log", OPTION_STRING},
     {"debug", OPTION_BOOLEAN},
     {"hub", OPTION_STRING},
     {"umask", OPTION_INT},
@@ -44,8 +45,10 @@
          "usage:\n"
 	 "    paraNode start\n"
 	 "options:\n"
 	 "    -logFacility=facility  Log to the specified syslog facility - default local0.\n"
+         "    -logMinPriority=pri minimum syslog priority to log, also filters file logging.\n"
+         "     defaults to \"warn\"\n"
          "    -log=file  Log to file instead of syslog.\n"
          "    -debug  Don't daemonize\n"
 	 "    -hub=host  Restrict access to connections from hub.\n"
 	 "    -umask=000  Set umask to run under - default 002.\n"
@@ -784,8 +787,16 @@
 hostName = getMachine();
 initRandom();
 getTicksToHundreths();
 
+/* log init */
+if (optionExists("log"))
+    logOpenFile("paraNode", optionVal("log", NULL));
+else    
+    logOpenSyslog("paraNode", optionVal("logFacility", NULL));
+logSetMinPriority(optionVal("logMinPriority", "info"));
+logInfo("starting paraNode on %s", hostName);
+
 /* Make job lists. */
 jobsRunning = newDlList();
 jobsFinished = newDlList();
 
@@ -798,9 +809,8 @@
 mainRudp->maxRetries = 12;
 
 /* Event loop. */
 findNow();
-logInfo("starting %s", hostName);
 for (;;)
     {
     /* Get next incoming message and optionally check to make
      * sure that it's from a host we trust, and check signature