--- a/Makefile
+++ b/Makefile
@@ -2,6 +2,7 @@
 
 MODULE_big = pgauditlogtofile
 OBJS = pgauditlogtofile.o logtofile.o
+REGRESS = logtofile
 
 EXTENSION = pgauditlogtofile
 DATA = pgauditlogtofile--1.0.sql pgauditlogtofile--1.0--1.2.sql pgauditlogtofile--1.2--1.3.sql pgauditlogtofile--1.3--1.4.sql pgauditlogtofile--1.4--1.5.sql
--- /dev/null
+++ b/expected/logtofile.out
@@ -0,0 +1,11 @@
+-- truncate log file before test
+create table foo (t text);
+copy foo from program 'sh -c "> /tmp/pgauditlogtofile"';
+select 1;
+ ?column? 
+----------
+        1
+(1 row)
+
+\! grep -o 'SESSION.*' /tmp/pgauditlogtofile
+SESSION,3,1,READ,SELECT,,,select 1;,<not logged>,,,,,,,,,pg_regress/logtofile
--- /dev/null
+++ b/sql/logtofile.sql
@@ -0,0 +1,7 @@
+-- truncate log file before test
+create table foo (t text);
+copy foo from program 'sh -c "> /tmp/pgauditlogtofile"';
+
+select 1;
+
+\! grep -o 'SESSION.*' /tmp/pgauditlogtofile
