I have this really simple program that isn't working. Actually I got something like that working many times but this time I can't figure out what is happening
#include <dlfcn.h>
#include <iostream>
#include "stdio.h"
#include "BaseTypes.h"
int main(int argc, char argv[]) {
const std::string debf_name {
"test.log"
};
try {
logging::add_file_log(
//keywords::file_name = pMainPath + "/logs/" + myName + ".log",
keywords::file_name = debf_name,
keywords::auto_flush = true,
// This makes the sink to write log records that look like this:
// YYYY-MM-DD HH:MI:SS: <normal> A normal severity message
// YYYY-MM-DD HH:MI:SS: <error> An error severity message
keywords::format =
(
expr::stream <<
expr::format_date_time < boost::posix_time::ptime > ("TimeStamp", "%Y-%m-%d %H:%M:%S") <<
": <" << logging::trivial::severity <<
"> " << expr::smessage
)
);
} catch (std::exception
const & e) {
std::cout << "Exception: " << typeid(e).name() << " what: " << e.what();
exit(1);
}
boost::log::core::get() -> set_filter(boost::log::trivial::severity >= logging::trivial::debug);
logging::add_common_attributes();
}
It crashes with "Illegal instruction" error and launching with gdb and giving bt to get stack trace gives this result:
Program received signal SIGILL, Illegal instruction. 0x0013c5aa in getloc (this=0x0) at /opt/rh/devtoolset-2/root/usr/include/c++/4.8.2/streambuf:227 227
{ return _M_buf_locale; } (gdb) bt #0 0x0013c5aa in getloc (this=0x0) at /opt/rh/devtoolset-2/root/usr/include/c++/4.8.2/streambuf:227 #1 boost::log::v2_mt_posix::aux::basic_ostringstreambuf<char, std::char_traits, std::allocator >::length_until_boundary (this=0x0, s=0x0, max_size=0) at /root/boost_1_72_0_deploy/include/boost/log/detail/attachable_sstream_buf.hpp:288
I can't figure out what is happening and what kind of actions I can take to make it work
Aucun commentaire:
Enregistrer un commentaire