Index: trunk/psLib/src/sys/psLogMsg.c
===================================================================
--- trunk/psLib/src/sys/psLogMsg.c	(revision 4944)
+++ trunk/psLib/src/sys/psLogMsg.c	(revision 4951)
@@ -12,6 +12,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-12 19:12:01 $
+ *  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-09-07 00:15:48 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -37,4 +37,5 @@
 #include <time.h>
 #include <unistd.h>
+#include <fcntl.h>
 
 #include "psLogMsg.h"
@@ -87,9 +88,10 @@
  An psBool: TRUE if successful.
  *****************************************************************************/
-bool psLogSetDestination(const char *dest)
+bool psLogSetDestination(int fd)
 {
-    char protocol[5];
-    char location[257];
-
+    //    char protocol[5];
+    //    char location[257];
+    //    char dest[257];
+    FILE *fp;
     // if logDest has not been initialized, do so before using it
     if (logDest == (FILE *) 1) {
@@ -97,55 +99,85 @@
     }
 
-    if (dest == NULL || strcmp(dest, "none") == 0) {
+    if ( fd == 1 ) {
+        //        fp = stdout;
         if (logDest != NULL && logDest != stderr && logDest != stdout) {
             fclose(logDest);
         }
+        logDest = stdout;
+    } else if (fd == 2) {
+        //        fp = stderr;
+        if (logDest != NULL && logDest != stderr && logDest != stdout) {
+            fclose(logDest);
+        }
+        logDest = stderr;
+    } else if (fd == 0) {
+        //        fp = NULL;
+        if (logDest != NULL && logDest != stderr && logDest != stdout) {
+            fclose(logDest);
+        }
         logDest = NULL;
         return true;
-    }
-
-    if (sscanf(dest, "%4s:%256s", protocol, location) < 2) {
-        psError(PS_ERR_LOCATION_INVALID, true,
-                PS_ERRORTEXT_psLogMsg_DESTINATION_MALFORMED,
-                dest);
-        return false;
-    }
-
-    if (strcmp(protocol, "dest") == 0) {
-        if (strcmp(location, "stderr") == 0) {
+    } else if (fd > 2) {
+        if (logDest != NULL && logDest != stderr && logDest != stdout) {
+            fclose(logDest);
+        }
+        fp = fdopen(fd, "w");
+        logDest = fp;
+        //        fclose(fp);
+        return true;
+    }
+
+    /*
+        if (dest == NULL || strcmp(dest, "none") == 0) {
             if (logDest != NULL && logDest != stderr && logDest != stdout) {
                 fclose(logDest);
             }
-            logDest = stderr;
+            logDest = NULL;
             return true;
         }
-        if (strcmp(location, "stdout") == 0) {
+        if (sscanf(dest, "%4s:%256s", protocol, location) < 2) {
+            psError(PS_ERR_LOCATION_INVALID, true,
+                    PS_ERRORTEXT_psLogMsg_DESTINATION_MALFORMED,
+                    dest);
+            return false;
+        }
+    */
+    /*
+     
+        if (strcmp(protocol, "dest") == 0) {
+            if (strcmp(location, "stderr") == 0) {
+                if (logDest != NULL && logDest != stderr && logDest != stdout) {
+                    fclose(logDest);
+                }
+                logDest = stderr;
+                return true;
+            }
+            if (strcmp(location, "stdout") == 0) {
+                if (logDest != NULL && logDest != stderr && logDest != stdout) {
+                    fclose(logDest);
+                }
+                logDest = stdout;
+                return true;
+            }
+            psError(PS_ERR_LOCATION_INVALID, true, PS_ERRORTEXT_psLogMsg_DEST_LOCATION_INVALID,
+                    location);
+            return 1;
+        } else if (strcmp(protocol, "file") == 0) {
+            FILE *file = fopen(location, "w");
+     
+            if (file == NULL) {
+                psError(PS_ERR_IO, true, PS_ERRORTEXT_psLogMsg_OPEN_FILE_FAILED,
+                        location);
+                return false;
+            }
             if (logDest != NULL && logDest != stderr && logDest != stdout) {
                 fclose(logDest);
             }
-            logDest = stdout;
+            logDest = file;
             return true;
         }
-        psError(PS_ERR_LOCATION_INVALID, true, PS_ERRORTEXT_psLogMsg_DEST_LOCATION_INVALID,
-                location);
-        return 1;
-    } else if (strcmp(protocol, "file") == 0) {
-        FILE *file = fopen(location, "w");
-
-        if (file == NULL) {
-            psError(PS_ERR_IO, true, PS_ERRORTEXT_psLogMsg_OPEN_FILE_FAILED,
-                    location);
-            return false;
-        }
-        if (logDest != NULL && logDest != stderr && logDest != stdout) {
-            fclose(logDest);
-        }
-        logDest = file;
-        return true;
-    }
-
-    psError(PS_ERR_LOCATION_INVALID, true, PS_ERRORTEXT_psLogMsg_UNSUPPORTED_PROTOCOL,
-            protocol);
-    return false;
+    */
+    return true;
+
 }
 
Index: trunk/psLib/src/sys/psLogMsg.h
===================================================================
--- trunk/psLib/src/sys/psLogMsg.h	(revision 4944)
+++ trunk/psLib/src/sys/psLogMsg.h	(revision 4951)
@@ -11,6 +11,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-07-15 02:33:54 $
+ *  @version $Revision: 1.30 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-09-07 00:15:48 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -33,5 +33,5 @@
  */
 bool psLogSetDestination(
-    const char *dest                   ///< Specifies where to send messages.
+    int fd                             ///< Specifies where to send messages.
 );
 
Index: trunk/psLib/src/sys/psTrace.c
===================================================================
--- trunk/psLib/src/sys/psTrace.c	(revision 4944)
+++ trunk/psLib/src/sys/psTrace.c	(revision 4951)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.56 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-02 21:32:06 $
+ *  @version $Revision: 1.57 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-09-07 00:15:48 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -245,8 +245,9 @@
  zero
 *****************************************************************************/
-psBool psTraceSetLevel(const char *comp,   // component of interest
-                       int level)  // desired trace level
+int psTraceSetLevel(const char *comp,   // component of interest
+                    int level)  // desired trace level
 {
     char *compName = NULL;
+    int prevLevel = -1;
 
     // If the root component tree does not exist, then initialize it.
@@ -267,5 +268,5 @@
         compName = (char *) comp;
     }
-
+    prevLevel = psTraceGetLevel(compName);
     // Add the new component to the component tree.
     if ( !componentAdd(compName, level) ) {
@@ -278,5 +279,6 @@
             psFree(compName);
         }
-        return false;
+        //        return false;
+        return -1;
     }
 
@@ -285,5 +287,6 @@
     }
 
-    return true;
+    //    return true;
+    return prevLevel;
 }
 
@@ -489,4 +492,5 @@
 void p_psTrace(const char *comp,        // component being traced
                int level,               // desired trace level
+               const char *format,
                ...)                     // arguments
 {
@@ -508,5 +512,5 @@
     // of it's associatedcomponent.
     if (level <= psTraceGetLevel(comp)) {
-        va_start(ap, level);
+        va_start(ap, format);
 
         // The following functions get the variable list of parameters with
@@ -517,7 +521,9 @@
         // We indent each message one space for each level of the message.
         for (i = 0; i < level; i++) {
-            fprintf(traceFP, " ");
+            //            fprintf(traceFP, " ");
+            fprintf(traceFP, "%s", format);
         }
         vfprintf(traceFP, fmt, ap);
+        //        vfprintf(traceFP, format, ap);
         va_end(ap);
     }
@@ -532,10 +538,10 @@
     /*
         bool special;
-     
+
         // XXX EAM perhaps return an error?
         if (fp == NULL) {
             return;
         }
-     
+
         // cannot close traceFP if one of the special FILE ptrs
         special  = (traceFP == NULL);
@@ -543,5 +549,5 @@
         special |= (traceFP == stdout);
         special |= (traceFP == stderr);
-     
+
         if (!special) {
             fclose (traceFP);
Index: trunk/psLib/src/sys/psTrace.h
===================================================================
--- trunk/psLib/src/sys/psTrace.h	(revision 4944)
+++ trunk/psLib/src/sys/psTrace.h	(revision 4951)
@@ -9,6 +9,6 @@
  *  @author GLG, MHPCC
  *
- *  @version $Revision: 1.36 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2005-09-02 21:32:06 $
+ *  @version $Revision: 1.37 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2005-09-07 00:15:48 $
  *
  *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
@@ -64,4 +64,5 @@
     const char *facil,                 ///< facilty of interest
     int level,                         ///< desired trace level
+    const char *format,                ///< printf-style format command
     ...                                ///< trace message arguments
 );
@@ -72,4 +73,5 @@
     const char *facil,                 ///< facilty of interest
     psS32 myLevel,                     ///< desired trace level
+    const char *format,                ///< printf-style format command
     ...                                ///< trace message arguments
 );
@@ -83,7 +85,7 @@
 /** Set trace level
  *
- *  @return psBool:       True if successful, otherwise false
+ *  @return int:       The previous level.
  */
-psBool psTraceSetLevel(
+int psTraceSetLevel(
     const char *facil,                 ///< facilty of interest
     int level                          ///< desired trace level
