diff --git a/configure.ac b/configure.ac
index 639feb9ddb9c41f8df650a31810d67524faf5c7f..1f775958334ea9f80ce219937ac2be7ac4675f28 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2023,7 +2023,7 @@ AM_CONDITIONAL([HAVEEAGLEFEEDBACK], [test $with_feedback = "EAGLE"])
 
 # Handle .in files.
 AC_CONFIG_FILES([Makefile src/Makefile examples/Makefile examples/Cooling/CoolingRates/Makefile doc/Makefile doc/Doxyfile tests/Makefile])
-AC_CONFIG_FILES([argparse/Makefile tools/Makefile logger/Makefile])
+AC_CONFIG_FILES([argparse/Makefile tools/Makefile logger/Makefile logger/tests/Makefile])
 AC_CONFIG_FILES([tests/testReading.sh], [chmod +x tests/testReading.sh])
 AC_CONFIG_FILES([tests/testActivePair.sh], [chmod +x tests/testActivePair.sh])
 AC_CONFIG_FILES([tests/test27cells.sh], [chmod +x tests/test27cells.sh])
diff --git a/logger/Makefile.am b/logger/Makefile.am
index f74c1645daeaa49af6defa0382fdf280cffbed15..ed560347ac0d627cd49a689afd2e086f2181df01 100644
--- a/logger/Makefile.am
+++ b/logger/Makefile.am
@@ -41,6 +41,9 @@ lib_LTLIBRARIES = liblogger.la
 # lib_LTLIBRARIES += liblogger_mpi.la
 # endif
 
+# subdirectories
+SUBDIRS = tests
+
 # List required headers
 include_HEADERS = logger_header.h logger_io.h logger_particle.h logger_time.h logger_tools.h logger_reader.h \
 	logger_index.h logger_logfile.h
diff --git a/logger/tests/Makefile.am b/logger/tests/Makefile.am
new file mode 100644
index 0000000000000000000000000000000000000000..bd488a16f62b98e43352c5953ad406c47a583a8e
--- /dev/null
+++ b/logger/tests/Makefile.am
@@ -0,0 +1,35 @@
+# This file is part of SWIFT.
+# Copyright (c) 2019 loic.hausammann@epfl.ch.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Add the source directory and the non-standard paths to the included library headers to CFLAGS
+AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/logger $(HDF5_CPPFLAGS) $(GSL_INCS) $(FFTW_INCS)
+
+AM_LDFLAGS = ../../src/.libs/libswiftsim.a ../.libs/liblogger.a $(HDF5_LDFLAGS) $(HDF5_LIBS) $(FFTW_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(TBBMALLOC_LIBS) $(GRACKLE_LIBS) $(GSL_LIBS) $(PROFILER_LIBS)
+
+# List of programs and scripts to run in the test suite
+TESTS = testHeader
+
+# List of test programs to compile
+check_PROGRAMS = testHeader
+
+# Rebuild tests when SWIFT is updated.
+$(check_PROGRAMS): ../../src/.libs/libswiftsim.a
+
+# Sources for the individual programs
+testHeader_SOURCES = testHeader.c
+
+# Files necessary for distribution
+EXTRA_DIST = swift_params.yml
diff --git a/logger/tests/swift_params.yml b/logger/tests/swift_params.yml
new file mode 100644
index 0000000000000000000000000000000000000000..c20d3f2c9128f507b81941490170e114ff2e0d13
--- /dev/null
+++ b/logger/tests/swift_params.yml
@@ -0,0 +1,6 @@
+# Parameter file for the tests
+Logger:
+  delta_step: 10
+  initial_buffer_size: 0.1 # in GB
+  buffer_scale: 10
+  basename: index
\ No newline at end of file
diff --git a/logger/tests/testHeader.c b/logger/tests/testHeader.c
new file mode 100644
index 0000000000000000000000000000000000000000..d52f56f741a5340167ca477af8e98ab26d129377
--- /dev/null
+++ b/logger/tests/testHeader.c
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * This file is part of SWIFT.
+ * Copyright (C) 2015 Matthieu Schaller (matthieu.schaller@durham.ac.uk).
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ ******************************************************************************/
+
+#include "swift.h"
+#include "logger_header.h"
+#include "logger_logfile.h"
+#include "logger_reader.h"
+
+int main(int argc, char *argv[]) {
+
+  /*
+    First generate the file.
+  */
+
+  message("Generating the dump.");
+  /* Create required structures. */
+  struct logger log;
+  struct swift_params params;
+  char filename[200] = "swift_params.yml";
+
+  /* Read parameters. */
+  parser_read_file(filename, &params);
+
+  /* Initialize the logger. */
+  logger_init(&log, &params);
+
+  /* get dump filename */
+  char dump_filename[PARSER_MAX_LINE_SIZE];
+  message("%s", log.base_name);
+  strcpy(dump_filename, log.base_name);
+  strcat(dump_filename, ".dump");
+
+  /* Write file header. */
+  logger_write_file_header(&log);
+
+  /* clean memory */
+  logger_clean(&log);
+  /*
+    Then read the file.
+  */
+
+  message("Reading the header.");
+  /* Generate required structure for reading. */
+  struct logger_logfile logfile;
+  struct logger_reader reader;
+
+  /* Set verbose level */
+  reader.verbose = 1;
+  
+  /* Read the header */
+  logger_logfile_init(&logfile, dump_filename, &reader,
+		      /* only_header */ 1);
+  /*
+    Finally check everything
+  */
+
+  struct header *h = &logfile.header;
+  message("Checking versions.");
+  assert(h->major_version == logger_major_version);
+  assert(h->minor_version == logger_minor_version);
+
+  message("Checking offset of first record");
+  assert(h->offset_first_record == logfile.log.file_size);
+
+  message("Checking number of masks");
+  assert(h->number_mask == logger_count_mask);
+
+  message("Checking masks");
+  for(int i = 0; i < logger_count_mask; i++) {
+    assert(logger_mask_data[i].size == h->masks[i].size);
+    assert(logger_mask_data[i].mask == h->masks[i].mask);
+    assert(strcmp(logger_mask_data[i].name, h->masks[i].name) == 0);
+  }
+
+  message("Checking offset direction");
+  assert(h->offset_direction == logger_offset_backward);
+
+  return 0;
+}