diff --git a/src/test/examples/testlibpq.c b/src/test/examples/testlibpq.c
index 0372781..ae163e4 100644
--- a/src/test/examples/testlibpq.c
+++ b/src/test/examples/testlibpq.c
@@ -26,6 +26,7 @@ main(int argc, char **argv)
        int                     nFields;
        int                     i,
                                j;
+       FILE            *trace_file;

        /*
         * If the user supplies a parameter on the command line, use it as the
@@ -40,6 +41,9 @@ main(int argc, char **argv)
        /* Make a connection to the database */
        conn = PQconnectdb(conninfo);

+       trace_file = fopen("/home/postgres/tracelog/trace.out","w");
+       PQtrace(conn, trace_file, 0);
+
        /* Check to see that the backend connection was successfully made */
        if (PQstatus(conn) != CONNECTION_OK)
        {
@@ -127,5 +131,6 @@ main(int argc, char **argv)
        /* close the connection to the database and cleanup */
        PQfinish(conn);

+       fclose(trace_file);
        return 0;
 }
