title: Can we create separate log files for each thread in boost library
body: <p>I want to know that can we create separate log files for each thread with executing some function or by using <code>add_file_log</code> function.</p>
  
  <p>The following program creates number of log files based on number of threads created. But we are executing same set of codes for same number of times. It may result in slow down of application for larger number of threads.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;boost/move/utility.hpp&gt;
  #include &lt;boost/log/sources/logger.hpp&gt;
  #include &lt;boost/log/sources/record_ostream.hpp&gt;
  #include &lt;boost/log/sources/global_logger_storage.hpp&gt;
  #include &lt;boost/log/utility/setup/file.hpp&gt;
  #include &lt;boost/log/utility/setup/common_attributes.hpp&gt;
  #include &lt;cstring&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;boost/thread.hpp&gt;
  #include &lt;boost/date_time.hpp&gt;
  namespace logging = boost::log;
  namespace src = boost::log::sources;
  namespace keywords = boost::log::keywords;
  int count = 0;
  class class_logging {
   public:
    void logging_function() {
      char filename[15] = "sample";
      char extension[5] = ".log";
      int c = count++;
      char num[10];
      std::sprintf(num, "%d", c);
      std::strcat(filename, num);
      std::strcat(filename, extension);
      logging::add_file_log(filename);
      logging::add_common_attributes();
      src::logger lg;
      logging::record rec = lg.open_record();
      if (rec) {
        logging::record_ostream strm(rec);
        strm &lt;&lt; "Count Value :" &lt;&lt; c;
        strm.flush();
        lg.push_record(boost::move(rec));
      }
    }
  };
  int main(int, char* []) {
    class_logging object[100];
    int total;
    std::cout &lt;&lt; "\nEnter no. of threads to produce : ";
    std::cin &gt;&gt; total;
    for (int i = 0; i &lt; total; i++) {
      boost::thread thread1(&amp;class_logging::logging_function, &amp;object[i]);
      std::cout &lt;&lt; "\nThread " &lt;&lt; i
                &lt;&lt; " is created whose id is : " &lt;&lt; thread1.get_id();
      thread1.join();
      std::cout &lt;&lt; "\nThread " &lt;&lt; i &lt;&lt; " is done...";
      thread1.detach();
    }
    return 0;
  }
  </code></pre>
  
  <p>Q-1) Are there any way to create log files dynamically?</p>