title: boost log file not written to
body: <p>I've been struggling with boost log for a while now - I got their simple example writing to a log file (<a href="http://boost-log.sourceforge.net/libs/log/example/doc/tutorial_file.cpp" rel="noreferrer">http://boost-log.sourceforge.net/libs/log/example/doc/tutorial_file.cpp</a>).  However, when I try to copy that code into a 'Logger' class, I can't get it to write to the log file.  I can see the file <code>default.log</code> get created, but there is nothing in it.</p>
  
  <p>I'm on debian 7 64bit.  Everything compiles fine - compile line is:</p>
  
  <pre><code>g++ -o build/Logger.o -c -std=c++11 -Wall -g -O0 -DBOOST_LOG_DYN_LINK -DDEBUG src/Logger.cpp
  g++ -o build/logtest build/Logger.o -lboost_log -lboost_log_setup -lboost_date_time -lboost_thread -lboost_wave -lboost_regex -lboost_program_options
  </code></pre>
  
  <p>Here's my code:</p>
  
  <p><code>Logger.cpp</code></p>
  
  <pre><code>/*
   * Logger.cpp
   *
   *  Created on: 2011-01-17
   *      Author: jarrett
   */
  
  #include "Logger.h"
  
  namespace logging = boost::log;
  namespace sinks = boost::log::sinks;
  namespace src = boost::log::sources;
  namespace expr = boost::log::expressions;
  namespace attrs = boost::log::attributes;
  namespace keywords = boost::log::keywords;
  
  namespace dhlogging {
  
  Logger::Logger(std::string fileName)
  {
      initialize(fileName);
  }
  
  Logger::Logger(Logger const&amp;)
  {
  }
  
  Logger::~Logger()
  {
  
  }
  
  Logger* Logger::logger_ = nullptr;
  Logger* Logger::getInstance(std::string logFile)
  {
      if ( Logger::logger_ == nullptr ) {
          logging::add_file_log( logFile );
  
          logging::core::get()-&gt;set_filter
          (
              logging::trivial::severity &gt;= logging::trivial::info
          );
  
          logging::add_common_attributes();
          Logger::logger_ = new Logger(logFile);
      }
  
      return Logger::logger_;
  }
  
  void Logger::initialize(std::string fileName)
  {   
      BOOST_LOG(log_) &lt;&lt; "Hello, World!";
      BOOST_LOG_SEV(log_, info) &lt;&lt; "Hello, World2!";
  }
  
  void Logger::logInfo(std::string message)
  {
      BOOST_LOG_SEV(log_, info) &lt;&lt; message;
  }
  
  void Logger::logDebug(std::string message)
  {
      BOOST_LOG_SEV(log_, debug) &lt;&lt; message;
  }
  
  void Logger::logWarn(std::string message)
  {
      BOOST_LOG_SEV(log_, warning) &lt;&lt; message;
  }
  
  void Logger::logError(std::string message)
  {
      BOOST_LOG_SEV(log_, error) &lt;&lt; message;
  }
  
  void Logger::logFatal(std::string message)
  {
      BOOST_LOG_SEV(log_, fatal) &lt;&lt; message;
  }
  
  }
  
  int main(int, char*[])
  {
      logging::add_common_attributes();
  
      using namespace logging::trivial;
  
      dhlogging::Logger::getInstance()-&gt;logInfo("himom");
  
      return 0;
  }
  </code></pre>
  
  <p><code>Logger.h</code></p>
  
  <pre><code>/*
   * Logger.h
   *
   *  Created on: 2011-01-17
   *      Author: jarrett
   */
  
  #ifndef LOGGER_H_
  #define LOGGER_H_
  
  #include &lt;map&gt;
  #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;
  
  namespace logging = boost::log;
  namespace sinks = boost::log::sinks;
  namespace src = boost::log::sources;
  namespace expr = boost::log::expressions;
  namespace attrs = boost::log::attributes;
  namespace keywords = boost::log::keywords;
  
  using namespace logging::trivial;
  
  namespace dhlogging {
  class Logger {
  
  public:
      static Logger* getInstance(std::string logFile = "default.log");
  
      void logInfo(std::string message);
      void logDebug(std::string message);
      void logWarn(std::string message);
      void logError(std::string message);
      void logFatal(std::string message);
  
  
  private:
      Logger(std::string fileName);
      Logger(Logger const&amp;);
      Logger&amp; operator=(Logger const&amp;);
      virtual ~Logger();
  
      void initialize(std::string fileName);
  
      src::severity_logger&lt; severity_level &gt; log_;
  
      static Logger* logger_; // singleton instance
  };
  }
  #endif /* LOGGER_H_ */
  </code></pre>