title: Boost logger flush to file
body: <p>I need boost to log after each logging code line is executed. Is it possible somehow to configure sink to act like this way? Currently log is filled just after program end.</p>
  
  <pre><code>#include &lt;boost/log/core.hpp&gt;
  #include &lt;boost/log/trivial.hpp&gt;
  #include &lt;boost/log/expressions.hpp&gt;
  #include &lt;boost/log/sinks/text_file_backend.hpp&gt;
  #include &lt;boost/log/utility/setup/file.hpp&gt;
  #include &lt;boost/log/utility/setup/common_attributes.hpp&gt;
  #include &lt;boost/log/sources/severity_logger.hpp&gt;
  #include &lt;boost/log/sources/record_ostream.hpp&gt;
  #include &lt;conio.h&gt;;
  
  namespace logging = boost::log;
  namespace src = boost::log::sources;
  namespace sinks = boost::log::sinks;
  namespace keywords = boost::log::keywords;
  
  void init()
  {
      logging::add_file_log
      (
          keywords::file_name = "sample_%N.log",                                        /*&lt; file name pattern &gt;*/
          keywords::rotation_size = 10 * 1024 * 1024,                                   /*&lt; rotate files every 10 MiB... &gt;*/
          keywords::time_based_rotation = sinks::file::rotation_at_time_point(0, 0, 0), /*&lt; ...or at midnight &gt;*/
          keywords::format = "[%TimeStamp%]: %Message%"                                 /*&lt; log record format &gt;*/
      );
  
      logging::core::get()-&gt;set_filter
      (
          logging::trivial::severity &gt;= logging::trivial::info
      );
      logging::core::get();
  }
  //]
  
  #endif
  
  int main(int, char*[])
  {
      init();
      logging::add_common_attributes();
  
      using namespace logging::trivial;
      src::severity_logger&lt; severity_level &gt; lg;
  
      BOOST_LOG_SEV(lg, trace) &lt;&lt; "A trace severity message";
      BOOST_LOG_SEV(lg, debug) &lt;&lt; "A debug severity message";
      BOOST_LOG_SEV(lg, info) &lt;&lt; "An informational severity message";
      BOOST_LOG_SEV(lg, warning) &lt;&lt; "A warning severity message";
      BOOST_LOG_SEV(lg, error) &lt;&lt; "An error severity message";
      BOOST_LOG_SEV(lg, fatal) &lt;&lt; "A fatal severity message";
      std::cin.get();
      return 0;
  }
  </code></pre>