diff --git a/scripts/msg_dumper.py b/scripts/msg_dumper.py
index 722146ea52a997f4c59b39b1109639dbf9488800..bca042754572bf12c84e88fc42e1f8d1758c4c7a 100755
--- a/scripts/msg_dumper.py
+++ b/scripts/msg_dumper.py
@@ -44,8 +44,9 @@ class MSGDumper(Module):
         if " W0" in data:
             source = "DataWriter"
 
-        self.fobj.write("{} [{}] - {}: {}\n".format(self.filename, source,
+        entry = "{} [{}] - {}: {}\n".format(self.filename, source,
                                                     log_level, data))
+        self.fobj.write(entry)
         return blob
 
     def finish(self):