Boost logo

Boost Users :

Subject: [Boost-users] Initializing of Boost.Log
From: Igor Mironchik (igor.mironchik_at_[hidden])
Date: 2015-01-11 01:55:13

Hi guys,

I want to initialize simple log. I do the next:

#include <boost/log/utility/setup/file.hpp>
#include <boost/log/trivial.hpp>
#include <boost/log/utility/setup/common_attributes.hpp>

void init()
         boost::log::keywords::file_name = "sample_%Y%m%d.log",
         boost::log::keywords::auto_flush = true,
         boost::log::keywords::open_mode = (std::ios::out | std::ios::app),
         boost::log::keywords::format = "[%TimeStamp%] [%Severity%]:


int main(int, char*[])

     BOOST_LOG_TRIVIAL( trace ) << "A trace severity message";
     BOOST_LOG_TRIVIAL( debug ) << "A debug severity message";
     BOOST_LOG_TRIVIAL( info ) << "An informational severity message";
     BOOST_LOG_TRIVIAL( warning ) << "A warning severity message";
     BOOST_LOG_TRIVIAL( error ) << "An error severity message";
     BOOST_LOG_TRIVIAL( fatal ) << "A fatal severity message";

     return 0;

But in log I receive:

[2015-Jan-11 09:51:04.082221] []: A trace severity message
[2015-Jan-11 09:51:04.082221] []: A debug severity message
[2015-Jan-11 09:51:04.082221] []: An informational severity message
[2015-Jan-11 09:51:04.092221] []: A warning severity message
[2015-Jan-11 09:51:04.092221] []: An error severity message
[2015-Jan-11 09:51:04.092221] []: A fatal severity message

And my question is how to initialize logging to write severity level in

What do I miss?

Thank you.

Best Regards,
Igor Mironchik.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at