title: Boost event logger
body: <p><a href="http://boost-log.sourceforge.net/libs/log/doc/html/log/detailed/sink_backends.html" rel="nofollow">http://boost-log.sourceforge.net/libs/log/doc/html/log/detailed/sink_backends.html</a></p>
  
  <p>In this page there is sample code to initialize boost windows event backends,
  but when I run it it gives memory error at first line.</p>
  
  <pre><code>void init_logging()
  {
      // Create an event log sink
      boost::shared_ptr&lt; sink_t &gt; sink(new sink_t());
  
      sink-&gt;set_formatter
      (
          expr::format("%1%: [%2%] - %3%")
              % expr::attr&lt; unsigned int &gt;("LineID")
              % expr::attr&lt; boost::posix_time::ptime &gt;("TimeStamp")
              % expr::smessage
      );
  
      // We'll have to map our custom levels to the event log event types
      sinks::event_log::custom_event_type_mapping&lt; severity_level &gt; mapping("Severity");
      mapping[normal] = sinks::event_log::info;
      mapping[warning] = sinks::event_log::warning;
      mapping[error] = sinks::event_log::error;
  
      sink-&gt;locked_backend()-&gt;set_event_type_mapper(mapping);
  
      // Add the sink to the core
      logging::core::get()-&gt;add_sink(sink);
  }
  </code></pre>
  
  <p>Here it fails to create sink_t object.</p>
  
  <pre><code>boost::shared_ptr&lt; sink_t &gt; sink(new sink_t());
  </code></pre>
  
  <p>Any idea what is the problem and how can I solve this?</p>
  
  <p>Also If you know any other source that I can learn using boost event logging please write.</p>