Index: trunk/psLib/src/sysUtils/psTrace.c
===================================================================
--- trunk/psLib/src/sysUtils/psTrace.c	(revision 560)
+++ trunk/psLib/src/sysUtils/psTrace.c	(revision 885)
@@ -39,4 +39,5 @@
 
 static Component *croot = NULL;           // The root of the trace component
+static FILE *traceFP = NULL;
 /*****************************************************************************
     componentAlloc(): allocate memory for a new node, and initialize members.
@@ -378,14 +379,22 @@
         va_start(ap, level);
 
-        // We indent each message one space foe each level of the message.
-        for (i = 0; i < level; i++) {
-            putchar(' ');
-        }
-
         // The following functions get the variable list of parameters with
         // which this function was called, and print them to the standard
         // output.
         fmt = va_arg(ap, char *);
-        vprintf(fmt, ap);
+
+        if (traceFP != NULL) {
+            // We indent each message one space for each level of the message.
+            for (i = 0; i < level; i++) {
+                fprintf(traceFP, " ");
+            }
+            vfprintf(traceFP, fmt, ap);
+        } else {
+            // We indent each message one space for each level of the message.
+            for (i = 0; i < level; i++) {
+                putchar(' ');
+            }
+            vprintf(fmt, ap);
+        }
         va_end(ap);
     }
@@ -393,2 +402,7 @@
     // NOTE: should we free *fmt as well?  Read the man page.
 }
+
+void psTraceSetDestination(FILE *fp)
+{
+    traceFP = fp;
+}
