diff --git a/examples/main.c b/examples/main.c
index c935ba51a63baa360567ab96c78086c1ec6b78f3..d99dec04b59f9d096d154620036a6da4a73f5931 100644
--- a/examples/main.c
+++ b/examples/main.c
@@ -1008,6 +1008,8 @@ int main(int argc, char *argv[]) {
 
   /* Write the state of the system before starting time integration. */
 #ifdef WITH_LOGGER
+    logger_ensure_size(e.log, e.total_nr_parts, e.total_nr_gparts, 0);
+    logger_log_all(e.log, &e);
     engine_dump_index(&e);
 #endif
     engine_dump_snapshot(&e);