diff --git a/src/debug/logger.cpp b/src/debug/logger.cpp
index b4c2fc3bad2ff3ea4d6db0e255b9e142fcabd61c..44f8f710d15d9b8261c148e4d8233c33e524f8a0 100644
--- a/src/debug/logger.cpp
+++ b/src/debug/logger.cpp
@@ -12,6 +12,7 @@
 #endif
 #define ENABLE_RT_LOG
 
+#include <sstream>
 #include <stdio.h>
 #include <iostream>
 #include <iomanip>      // std::setprecision
@@ -65,7 +66,9 @@ namespace dynamicgraph
     if( isStreamMsg(type))
       {
         // check whether counter already exists
-        string id = file+toString(line);
+        std::ostringstream oss;
+	oss << file << line;
+	std::string id (oss.str());
         map<string,double>::iterator it = m_stream_msg_counters.find(id);
         if(it == m_stream_msg_counters.end())
 	  {