Hi all,
I am trying to use Boost.Log for my application. The log code is in shared
library (a plugin). Here is how I set up my .so logging, according to the
documentation:
// ville_numerique_logging.hpp
#include
#include
#include
#include
#include
#include
enum severity_level
{
normal,
notification,
warning,
error,
critical
};
BOOST_LOG_DECLARE_GLOBAL_LOGGER_INIT(my_logger,
boost::log::sources::severity_logger< >)
{
boost::log::init_log_to_file
(
boost::log::keywords::file_name = "/home/olivier/ville_numerique.log",
boost::log::formatters::attr< unsigned int >("LineID"),
boost::log::keywords::format = "[%TimeStamp%]: %_%"
// log record format
);
// boost::log::core::get()->set_filter
// (
// boost::log::filters::attr<
boost::log::trivial::severity_level >("Severity") >=
boost::log::trivial::info
// );
return boost::log::sources::severity_logger< >();
}
In some of my method, I then try lo log:
src::severity_logger< >& lg = my_logger::get();
BOOST_LOG_SEV(lg, normal) << "A regular message";
BOOST_LOG_SEV(lg, warning) << "Something bad is going on but I can
handle it";
BOOST_LOG_SEV(lg, critical) << "Everything crumbles, shoot me now!";
But, nothing happens. The file is not created.
If I uncomment the set_filter lines, it throws an exception: "Requested
attribute value not found"
Could you please help? I am fighting with this for a too long time now.
Regards,
Olivier
-----------------------------------------------------
Olivier Tournaire
MATIS - Institut Géographique National
73, Ave de Paris
94165 St Mandé cedex, France
tel: (+33) 1 43 98 84 29
fax: (+33) 1 43 98 85 81