title: Logger Not Storing Recorded Information to File After a Crash
body: <p>Well, what good is a logger if it only keeps a record when things go well?</p>
  
  <p>It is a very simple thing, the logger, that I wanted to test before I expanded it:</p>
  
  <p>// Logger.h</p>
  
  <pre><code>class Logger : boost::noncopyable
  {    
  public:
      static void write(std::string const&amp; msg, int line, std::string const&amp; file);
  
  private:
      Logger();
  
  private:
      static std::ofstream m_sOut;
  };
  
  #define LOG(msg) Logger::write(msg, __LINE__, __FILE__)
  </code></pre>
  
  <p>// Logger.cpp</p>
  
  <pre><code>std::ofstream Logger::m_sOut("Logfile");
  
  void Logger::write(const std::string &amp;msg, int line, const std::string &amp;file, Level level /* = Info */)
  {
      m_sOut &lt;&lt; file &lt;&lt; ":  " &lt;&lt; line &lt;&lt; ":  " &lt;&lt; msg &lt;&lt; "\n";
  }
  </code></pre>
  
  <p>I fear that this is too simple. If I exit the program normally, it outputs as expected to my logfile. However, if there is a crash, there is no output. </p>
  
  <p>What do I have to do to ensure that it outputs to a log regardless of a crash?</p>