diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c
index 3bd0113..3e70306 100644
--- a/src/interfaces/libpq/fe-secure.c
+++ b/src/interfaces/libpq/fe-secure.c
@@ -871,11 +871,15 @@ pq_lockingcallback(int mode, int n, const char *file, int line)
 	{
 		if (pthread_mutex_lock(&pq_lockarray[n]))
 			PGTHREAD_ERROR("failed to lock mutex");
+		printf("%ld locking callback:   lock %d %s:%d\n", pthread_self(), n, file, line);
+		fflush(stdout);
 	}
 	else
 	{
 		if (pthread_mutex_unlock(&pq_lockarray[n]))
 			PGTHREAD_ERROR("failed to unlock mutex");
+		printf("%ld locking callback: unlock %d %s:%d\n", pthread_self(), n, file, line);
+		fflush(stdout);
 	}
 }
 #endif   /* ENABLE_THREAD_SAFETY */
