Asynchronous logging using Boost.log?

jack
2012-04-09
2013-06-03
1 2 > >> (Page 1 of 2)
  • jack

    jack - 2012-04-09

    I am creating a log file using Asynchronous front-end for my application like this

    BOOST_LOG_DECLARE_GLOBAL_LOGGER(test_lg, src::logger_mt)

    void thread_fun(char* errMsg)
    {
       
        BOOST_LOG_SCOPED_THREAD_TAG("ThreadID", boost::thread::id, boost::this_thread::get_id());

    BOOST_LOG(get_test_lg()) <<errMsg;

    BOOST_LOG(get_test_lg()) << "Log record1 ";

    }

    int main()
    {
        try
        {

            shared_ptr< std::ostream > strm(new std::ofstream("test.log"));
            if (!strm->good())
                throw std::runtime_error("Failed to open a text log file");

            typedef sinks::asynchronous_sink< sinks::text_ostream_backend > sink_t;

        boost::shared_ptr< logging::core > core = logging::core::get();

      
        boost::shared_ptr< sinks::text_ostream_backend > backend =
            boost::make_shared< sinks::text_ostream_backend >();
        backend->add_stream(
            boost::shared_ptr< std::ostream >(&std::clog, logging::empty_deleter()));

       
        boost::shared_ptr< sink_t > sink(new sink_t(backend));
        core->add_sink(sink);
            sink->locked_backend()->add_stream(strm);

            sink->locked_backend()->set_formatter(
                fmt::format("%1%:   - %4%")
                    % fmt::attr< unsigned int >("Line #")
                    % fmt::date_time< boost::posix_time::ptime >("TimeStamp")
                    % fmt::attr< boost::thread::id >("ThreadID")
                    % fmt::message()
                );

          
            logging::core::get()->add_sink(sink);

         
            shared_ptr< logging::attribute > attr(new attrs::local_clock);
            logging::core::get()->add_global_attribute("TimeStamp", attr);
            attr.reset(new attrs::counter< unsigned int >);
            logging::core::get()->add_global_attribute("Line #", attr);

    threads.create_thread(boost::bind(&thread_fun,(char*)"testLog0"));
    threads.create_thread(boost::bind(&thread_fun,(char*)"testLog1"));

                 threads.join_all();

          sink->stop();
                  sink->feed_records();
          
            return 0;
        }
        catch (std::exception& e)
        {
            std::cout << "FAILURE: " << e.what() << std::endl;
            return 1;
        }
    }

    If I create a specific thread only logging is happening otherwise it is not happening.
    for every logging it is creating different thread ID is there any method to do logging all messages with single thread ID or without creating a thread?

     
  • Andrey Semashev

    Andrey Semashev - 2012-04-09

    I'm sorry, I don't understand what you mean. Naturally, different threads have unique ids, so it is expected to see different ids in the log. If you don't need thread ids just don't add the attribute.

     
  • jack

    jack - 2012-04-10

    Thanks for response , I am trying to use asynchronous logging like trivial or synchronous. In trivial and synchronous logging by using the macro (BOOST_LOG) we can write the log records to the  log file after initialization of the Sinks and we can  use the Macro any where in the main function. If I do the same for asynchronous for logging log records are not going to the log file. Can you please explain me how to Asynchronous logging in correct manner.

    thank you,
    jack

     
  • Andrey Semashev

    Andrey Semashev - 2012-04-10

    Aside from flushing the queued records at process termination it shouldn't be much different from synchronous logging. Does the async_log example work for you?

     
  • jack

    jack - 2012-04-10

    async_log example is working fine.  I want to perform logging in my application. For example my application having adding ,multiply and division process. after every execution of steps  I need to write log record into log file. In asynchronous logging the logging is happening from creation of thread (threads.create_thread(boost::bind(&thread_fun)) with in that we are performing logging messages by using the macro. Is there any possibility to use the macro after the execution of the steps  in the application.

     
  • Andrey Semashev

    Andrey Semashev - 2012-04-10

    It doesn't matter which threads emit log records. The example could have written all log records from the main thread as well. The whole difference between asynchronous and synchronous logging is that in the former case log records are processed by a separate thread created by the sink implicitly. In fact, the code that writes logs is not aware what kind of sinks process log records.

     
  • jack

    jack - 2012-04-11

    Hi,

    I have written a cpp file like this

    Logging.cpp::

    #include "application.h"
    #include <Windows.h>
    #include <stdexcept>
    #include <string>
    #include <iostream>
    #include <fstream>
    #include <functional>
    #include <boost/ref.hpp>
    #include <boost/bind.hpp>
    #include <boost/shared_ptr.hpp>
    #include <boost/date_time/posix_time/posix_time_types.hpp>
    #include <boost/thread/thread.hpp>
    #include <boost/thread/barrier.hpp>

    #include <boost/log/common.hpp>
    #include <boost/log/filters.hpp>
    #include <boost/log/formatters.hpp>
    #include <boost/log/attributes.hpp>
    #include <boost/log/sinks.hpp>
    #include <boost/log/utility/empty_deleter.hpp>
    #include <boost/log/utility/record_ordering.hpp>

    namespace logging = boost::log;
    namespace attrs = boost::log::attributes;
    namespace src = boost::log::sources;
    namespace sinks = boost::log::sinks;
    namespace fmt = boost::log::formatters;
    namespace keywords = boost::log::keywords;

    using boost::shared_ptr;
    using namespace std;

    BOOST_LOG_DECLARE_GLOBAL_LOGGER(test_lg, src::logger_mt)

    void thread_fun(char* errMsg)
    {
        BOOST_LOG_SCOPED_THREAD_TAG("ThreadID", boost::thread::id, boost::this_thread::get_id

    ()); 
    BOOST_LOG(get_test_lg()) <<errMsg;

    }

    void stop_logging()
    {
    typedef sinks::asynchronous_sink< sinks::text_ostream_backend > sink_t;

            boost::shared_ptr< logging::core > core = logging::core::get();
    boost::shared_ptr< sink_t > sink(new sink_t());
       
    core->remove_sink(sink);   // Remove the sink from the core, so that no records are

    passed to it
    sink->stop(); 
    sink->feed_records();
    sink.reset();
    }

    void AsynLogging()
    {
        try
        {
            shared_ptr< std::ostream > strm(new std::ofstream("test.log"));  
            if (!strm->good())
                throw std::runtime_error("Failed to open a text log file");

            typedef sinks::asynchronous_sink< sinks::text_ostream_backend > sink_t; 
        boost::shared_ptr< logging::core > core = logging::core::get();
      
        boost::shared_ptr< sinks::text_ostream_backend > backend =
            boost::make_shared< sinks::text_ostream_backend >();    
    backend->add_stream(
            boost::shared_ptr< std::ostream >(&std::clog, logging::empty_deleter()));

    boost::shared_ptr< sink_t > sink(new sink_t(backend)); 
        core->add_sink(sink);
            sink->locked_backend()->add_stream(strm);

            sink->locked_backend()->set_formatter(
                fmt::format("%1%:   - %4%")
                    % fmt::attr< unsigned int >("Line #")
                    % fmt::date_time< boost::posix_time::ptime >("TimeStamp")
                    % fmt::attr< boost::thread::id >("ThreadID")
                    % fmt::message()
                );

            logging::core::get()->add_sink(sink);  

            shared_ptr< logging::attribute > attr(new attrs::local_clock);  
            logging::core::get()->add_global_attribute("TimeStamp", attr);
            attr.reset(new attrs::counter< unsigned int >);
            logging::core::get()->add_global_attribute("Line #", attr);

        }
        catch (std::exception& e)
        {
            std::cout << "FAILURE: " << e.what() << std::endl;
        }
    }

    int main()
    {
    int s;
    AsynLogging();
    Application app;
    boost::thread_group threads;
    threads.create_thread(boost::bind(&thread_fun,(char*)"Start LOgging"));
    threads.create_thread(boost::bind(&thread_fun,(char*)"started the sum "));
    app.Sum(4,5);
    threads.create_thread(boost::bind(&thread_fun,(char*)"end the sum"));
    threads.create_thread(boost::bind(&thread_fun,(char*)"start the average"));
    app.Average(6,7);
    threads.create_thread(boost::bind(&thread_fun,(char*)"end the average"));
    threads.create_thread(boost::bind(&thread_fun,(char*)"end  LOgging"));
    threads.join_all();

    stop_logging();

    return 0;
    }


    application.h::

    #ifndef _APPLICATION_H_
    #define _APPLICATION_H_

    #include <iostream>
    #include <String>
    #include "logging.h"

    class Application
    {
    public:
    int Sum(int a, int b);
    int Average(int a, int b);
    };

    #endif

    application.cpp::

    #include "application.h"
    #include <boost/thread/thread.hpp>
    int Application::Sum(int a, int b)
    {
    // NEED LOGGING HOW TO PERFORM AYNCHRONOUS LOGGING HERE(WITH IN THE DEFINITION OF

    FUNCTION)
    return a+b;
    };

    int Application::Average(int a, int b)
    {
    //NEED LOGGING HOW TO PERFORM AYNCHRONOUS LOGGING HERE(WITH IN THE DEFINITION OF

    FUNCTION)
    b = (a+b)/2;
    return b;
    };

    The above code is workig but the for every log record it is creating a different thread id.

    Is there any method to write ALL log record in single thread. I tried to perfrom logging

    with in the function definition (application.cpp) as shown above. can you help me
    1. how to perfrom logging with in the function.
    2. Is if necessary to create a thread to perform asynchronous logging(calling the thread_fun())

     
  • Andrey Semashev

    Andrey Semashev - 2012-04-11

    The above code is workig but the for every log record it is creating a different thread id.

    Of course it does, since you create a different thread for every log record you make. Why do you do that?

    1. how to perfrom logging with in the function.

    You have it in your example, it's this line:

    BOOST_LOG(get_test_lg()) <<errMsg;
    

    Just write similar lines where you need logging and you'll have it.

    2. Is if necessary to create a thread to perform asynchronous logging(calling the thread_fun())

    Like I said, the thread is created by the sink implicitly. To make it clear, it is not the thread that runs thread_fun() in your example. However, you can suppress this thread creation and create it yourself, if you like.

     
  • jack

    jack - 2012-04-12

    I suppressed the Thread creation the asynchronous logging it is fine for logging.The logging happens after calling the stop_logging() function in my previous code if application crashes in middle(i.e., before calling the stop_logging function) the logging not happening. How can I get logging up to the application crash to know why the application crashed by seeing the log file.

     
  • jack

    jack - 2012-04-16

    When may I expect the reply for the above post

     
  • Andrey Semashev

    Andrey Semashev - 2012-04-16

    If I understood correctly, you want to see every log record up to the moment of the crash, right? In that case asynchronous logging won't help you by nature. You need to switch to synchronous logging and also enable the auto-flush feature in the sink backend.

     
  • jack

    jack - 2012-04-20

    I want to see every log record up to crash.
    1. Will the front end automatically feed log records to the back-end or feeds after calling feed_records().

    2. If I call feed_records() periodically (ex: After every five or ten log records) to write log records into file. Will it give any performance drawback by calling it many times.

    3. For performance reasons only I want to use Asynchronous logging. May I know the exact difference between Synchronous and Asynchronous logging.

    4. I read one line in Boost.Log i.e.,
    "start_thread - If true, the frontend will start a dedicated thread to feed log records to the backend. Otherwise the user is expected to call either run or feed_records to feed records."  Where we need to pass this argument and can you explain me about this.

    5. 5. Can I do Auto_Flush to the asynchronous sink. Is there any performance degrade if I use auto_flush.

     
  • Andrey Semashev

    Andrey Semashev - 2012-04-20

    You can't call feed_records while the internal feeding thread is running. So the answer for (1) is no, because at the point when you call feed_records the internal thread must not be running.

    Answering (2), if you suppress the internal thread creation and call feed_records yourself then the performance will only depend on how often you call it. The internal thread does the same thing more efficiently because it blocks when there are no log records queued.

    (3) Did you read the docs? The difference is which thread processes the log records. When the sink is synchronous, the thread that emits the record does this, when the sink is asynchronous its dedicated thread does this. And regarding performance, asynchronous logging doesn't improve performance unless the backend tends to block for considerable amount of time.

    (4) You pass this named argument to the frontend constructor, like this:

    boost::shared_ptr< sink_t > sink(new sink_t(backend, keywords::start_thread = false));
    

    (5) Auto-flush is a backend feature, it doesn't flush the log record queue. There is no auto-flushing for the record queue because it is pointless - you better use synchronous logging instead. You can flush all sinks however by calling the same-named method in the logging core, but it is not expected to be called frequently. The asynchronous sink will block on flush until the record queue is emptied. So will all logging threads.

     
  • jack

    jack - 2012-04-20

    In my code mentioned. Until the program execute the feed_record() no log writing into the log file after calling feed_records() only records are writing into the log file. If any crach before the feed_record() call no record is going to the log file.
    Because of that I asked about auto_flush and feed_records(). For synchronous logging, will the application  execute 2nd line  after the log record(1st line is logging) successfull if the first line is not sucessfull will it execute the next line.

    And I did not get the line "And regarding performance, asynchronous logging   doesn't  improveperformance unless the backend tends to block for considerable amount of time." How to block the back end.

     
  • Andrey Semashev

    Andrey Semashev - 2012-04-20

    Until the program execute the feed_record() no log writing into the log file after calling feed_records() only records are writing into the log file. If any crach before the feed_record() call no record is going to the log file.

    There is no guarantee when the internal thread processes the queued log records. That's exactly the reason why async logging is not suitable for debugging crashes.

    For synchronous logging, will the application  execute 2nd line  after the log record(1st line is logging) successfull if the first line is not sucessfull will it execute the next line.

    I didn't understand this.

    How to block the back end.

    It depends on the backend. For example, it may block on attempt to write to a file on a busy filesystem.

     
  • jack

    jack - 2012-04-20

    Thanks for reply,
    I wrote the code for log initialization like this for asynchronous log, with out calling feed_records it is writing the log file.
    asynclog.cpp

    #include "asynclog.h"

    using namespace std;

    boost::shared_ptr< sink_t > init_logging()
    {
    logging::init_log_to_file(keywords::file_name = "sample_%N.log",keywords::auto_flush = true,
    keywords::format = "%Line #% :  - %_%");

    boost::shared_ptr< logging::core > core = logging::core::get();
    boost::shared_ptr< sinks::text_ostream_backend > backend =
    boost::make_shared< sinks::text_ostream_backend >();

        boost::shared_ptr< sink_t > sink(new sink_t(backend));
        core->add_sink(sink);

    logging::core::get()->add_sink(sink);

    shared_ptr< logging::attribute > attr(new attrs::local_clock);  
        logging::core::get()->add_global_attribute("TimeStamp", attr);
        attr.reset(new attrs::counter< unsigned int >);
        logging::core::get()->add_global_attribute("Line #", attr);

        return sink;
    }

    asynclog.h

    #ifndef _ASYNCLOG_H_
    #define _ASYNCLOG_H_

    #include <Windows.h>
    #include <stdexcept>
    #include <string>
    #include <fstream>
    #include <iostream>
    #include <boost/shared_ptr.hpp>
    #include <boost/log/core/core.hpp>
    #include <boost/log/filters.hpp>
    #include <boost/log/formatters.hpp>
    #include <boost/log/sinks/async_frontend.hpp>
    #include <boost/log/sinks/text_ostream_backend.hpp>
    #include <boost/log/sources/severity_channel_logger.hpp>
    #include <boost/log/sources/record_ostream.hpp>
    #include <boost/log/utility/empty_deleter.hpp>
    #include <boost/log/attributes.hpp>
    #include <boost/date_time/posix_time/posix_time_types.hpp>
    #include <boost/log/utility/init/from_stream.hpp>
    #include <boost/log/utility/init/to_file.hpp>
    #include <boost/log/common.hpp>
    namespace logging = boost::log;
    namespace src = boost::log::sources;
    namespace flt = boost::log::filters;
    namespace fmt = boost::log::formatters;
    namespace sinks = boost::log::sinks;
    namespace keywords = boost::log::keywords;
    namespace attrs = boost::log::attributes;

    using boost::shared_ptr;
    typedef sinks::asynchronous_sink< sinks::text_ostream_backend > sink_t;
    boost::shared_ptr< sink_t > init_logging();

    BOOST_LOG_DECLARE_GLOBAL_LOGGER_INIT(test_lg, src::logger_mt)
    {

    init_logging();
    return src::logger_mt();
    }

    #endif

    Whether I use auto_flush or not it is writing log records. can I use this with out feed_records().

     
  • Andrey Semashev

    Andrey Semashev - 2012-04-20

    No, feed_records call is needed at process termination. You should really read the docs.

     
  • jack

    jack - 2012-04-20

    Thank you , For your excellent response I will read the docs and will get back to you.

     
  • jack

    jack - 2012-04-21

    I tried to include boost logging in our project some link errors are coming I tried to solve them but I am help less can you tell me how to resolve these errors. I included the libraries  in my project.

    the errors

    Compiling…
    cl : Command line warning D9035 : option 'Wp64' has been deprecated and will be removed in a future release
    asynclog.cpp
    Linking…

    asynclog.obj : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem3::path_traits::convert(char const *,char const *,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class std::codecvt<wchar_t,char,int> const &)" (?convert@path_traits@filesystem3@boost@@YAXPBD0AAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@ABV?$codecvt@_WDH@5@@Z)
    asynclog.obj : error LNK2001: unresolved external symbol "private: static class std::codecvt<wchar_t,char,int> const * & __cdecl boost::filesystem3::path::wchar_t_codecvt_facet(void)" (?wchar_t_codecvt_facet@path@filesystem3@boost@@CAAAPBV?$codecvt@_WDH@std@@XZ)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "private: static class std::codecvt<wchar_t,char,int> const * & __cdecl boost::filesystem3::path::wchar_t_codecvt_facet(void)" (?wchar_t_codecvt_facet@path@filesystem3@boost@@CAAAPBV?$codecvt@_WDH@std@@XZ)
    libboost_log-vc90-mt-s-1_49.lib(sink_frontends.obj) : error LNK2001: unresolved external symbol "bool __cdecl boost::this_thread::interruptible_wait(void *,struct boost::detail::timeout)" (?interruptible_wait@this_thread@boost@@YA_NPAXUtimeout@detail@2@@Z)
    libboost_log-vc90-mt-s-1_49.lib(sink_frontends.obj) : error LNK2001: unresolved external symbol "public: __thiscall boost::thread::~thread(void)" (??1thread@boost@@QAE@XZ)
    libboost_log-vc90-mt-s-1_49.lib(sink_frontends.obj) : error LNK2001: unresolved external symbol "private: void __thiscall boost::thread::start_thread(void)" (?start_thread@thread@boost@@AAEXXZ)
    libboost_log-vc90-mt-s-1_49.lib(sink_frontends.obj) : error LNK2001: unresolved external symbol "public: void __thiscall boost::thread::join(void)" (?join@thread@boost@@QAEXXZ)
    libboost_log-vc90-mt-s-1_49.lib(sink_frontends.obj) : error LNK2001: unresolved external symbol "class boost::thread::id __cdecl boost::this_thread::get_id(void)" (?get_id@this_thread@boost@@YA?AVid@thread@2@XZ)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "class boost::filesystem3::file_status __cdecl boost::filesystem3::detail::status(class boost::filesystem3::path const &,class boost::system::error_code *)" (?status@detail@filesystem3@boost@@YA?AVfile_status@23@ABVpath@23@PAVerror_code@system@3@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "bool __cdecl boost::filesystem3::detail::create_directories(class boost::filesystem3::path const &,class boost::system::error_code *)" (?create_directories@detail@filesystem3@boost@@YA_NABVpath@23@PAVerror_code@system@3@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "bool __cdecl boost::filesystem3::detail::equivalent(class boost::filesystem3::path const &,class boost::filesystem3::path const &,class boost::system::error_code *)" (?equivalent@detail@filesystem3@boost@@YA_NABVpath@23@0PAVerror_code@system@3@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "unsigned __int64 __cdecl boost::filesystem3::detail::file_size(class boost::filesystem3::path const &,class boost::system::error_code *)" (?file_size@detail@filesystem3@boost@@YA_KABVpath@23@PAVerror_code@system@3@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "__int64 __cdecl boost::filesystem3::detail::last_write_time(class boost::filesystem3::path const &,class boost::system::error_code *)" (?last_write_time@detail@filesystem3@boost@@YA_JABVpath@23@PAVerror_code@system@3@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "bool __cdecl boost::filesystem3::detail::remove(class boost::filesystem3::path const &,class boost::system::error_code *)" (?remove@detail@filesystem3@boost@@YA_NABVpath@23@PAVerror_code@system@3@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem3::detail::rename(class boost::filesystem3::path const &,class boost::filesystem3::path const &,class boost::system::error_code *)" (?rename@detail@filesystem3@boost@@YAXABVpath@23@0PAVerror_code@system@3@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "struct boost::filesystem3::space_info __cdecl boost::filesystem3::detail::space(class boost::filesystem3::path const &,class boost::system::error_code *)" (?space@detail@filesystem3@boost@@YA?AUspace_info@23@ABVpath@23@PAVerror_code@system@3@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem3::detail::directory_iterator_increment(class boost::filesystem3::directory_iterator &,class boost::system::error_code *)" (?directory_iterator_increment@detail@filesystem3@boost@@YAXAAVdirectory_iterator@23@PAVerror_code@system@3@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "class boost::filesystem3::path __cdecl boost::filesystem3::detail::current_path(class boost::system::error_code *)" (?current_path@detail@filesystem3@boost@@YA?AVpath@23@PAVerror_code@system@3@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "class boost::filesystem3::path __cdecl boost::filesystem3::detail::system_complete(class boost::filesystem3::path const &,class boost::system::error_code *)" (?system_complete@detail@filesystem3@boost@@YA?AVpath@23@ABV423@PAVerror_code@system@3@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "class boost::filesystem3::path __cdecl boost::filesystem3::absolute(class boost::filesystem3::path const &,class boost::filesystem3::path const &)" (?absolute@filesystem3@boost@@YA?AVpath@12@ABV312@0@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem3::path_traits::dispatch(class boost::filesystem3::directory_entry const &,class std::basic_string<wchar_t,struct std::char_traits<wchar_t>,class std::allocator<wchar_t> > &,class std::codecvt<wchar_t,char,int> const &)" (?dispatch@path_traits@filesystem3@boost@@YAXABVdirectory_entry@23@AAV?$basic_string@_WU?$char_traits@_W@std@@V?$allocator@_W@2@@std@@ABV?$codecvt@_WDH@6@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "public: class boost::filesystem3::path __thiscall boost::filesystem3::path::parent_path(void)const " (?parent_path@path@filesystem3@boost@@QBE?AV123@XZ)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "class boost::system::error_code __cdecl boost::filesystem3::detail::dir_itr_close(void * &)" (?dir_itr_close@detail@filesystem3@boost@@YA?AVerror_code@system@3@AAPAX@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem3::path_traits::convert(wchar_t const *,wchar_t const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &,class std::codecvt<wchar_t,char,int> const &)" (?convert@path_traits@filesystem3@boost@@YAXPB_W0AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV?$codecvt@_WDH@5@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "public: class boost::filesystem3::path & __thiscall boost::filesystem3::path::operator/=(class boost::filesystem3::path const &)" (??_0path@filesystem3@boost@@QAEAAV012@ABV012@@Z)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "public: class boost::filesystem3::path __thiscall boost::filesystem3::path::filename(void)const " (?filename@path@filesystem3@boost@@QBE?AV123@XZ)
    libboost_log-vc90-mt-s-1_49.lib(text_file_backend.obj) : error LNK2001: unresolved external symbol "void __cdecl boost::filesystem3::detail::directory_iterator_construct(class boost::filesystem3::directory_iterator &,class boost::filesystem3::path const &,class boost::system::error_code *)" (?directory_iterator_construct@detail@filesystem3@boost@@YAXAAVdirectory_iterator@23@ABVpath@23@PAVerror_code@system@3@@Z)
    libboost_log-vc90-mt-s-1_49.lib(core.obj) : error LNK2001: unresolved external symbol "void * __cdecl boost::detail::get_tss_data(void const *)" (?get_tss_data@detail@boost@@YAPAXPBX@Z)
    libboost_log_setup-vc90-mt-s-1_49.lib(formatter_parser.obj) : error LNK2001: unresolved external symbol "void * __cdecl boost::detail::get_tss_data(void const *)" (?get_tss_data@detail@boost@@YAPAXPBX@Z)
    libboost_log-vc90-mt-s-1_49.lib(core.obj) : error LNK2001: unresolved external symbol "void __cdecl boost::detail::set_tss_data(void const *,class boost::shared_ptr<struct boost::detail::tss_cleanup_function>,void *,bool)" (?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z)
    libboost_log_setup-vc90-mt-s-1_49.lib(formatter_parser.obj) : error LNK2001: unresolved external symbol "void __cdecl boost::detail::set_tss_data(void const *,class boost::shared_ptr<struct boost::detail::tss_cleanup_function>,void *,bool)" (?set_tss_data@detail@boost@@YAXPBXV?$shared_ptr@Utss_cleanup_function@detail@boost@@@2@PAX_N@Z)

    32 error(s), 1 warning(s)

     
  • Andrey Semashev

    Andrey Semashev - 2012-04-21

    You haven't specified the other boost libraries (such as boost_thread, boost_filesystem, etc.) to the linker. See what symbols are missing and add corresponding libraries to the linker command line.

     
  • jack

    jack - 2012-04-24

    I read the docs I want to know about the auto_flush. If I use auto_flush in asynchronous sink is there any performance degrade. If not can you explain me.

     
  • Andrey Semashev

    Andrey Semashev - 2012-04-24

    I've already answered on the auto-flush feature in post #13. If you enable auto-flush in a file backend, it will degrade performance somewhat for it will not cache formatted records before pushing them to the filesystem. But in any case, it will not cause records queued in the frontend to be flushed to the backend. There is no auto-flush for a frontend.

     
  • jack

    jack - 2012-05-18

    Hi ,
    I have added severity levels to Asynchronous logging they are in order info, warning, error, debug, edebug. In the logging I can display the log messages for individual severity levels like info, warning etc .
    May I display the severity logs of warning and error only Is there any condition like  "warning <= severity <= error"

     
  • Andrey Semashev

    Andrey Semashev - 2012-05-18

    Yes, you can filter the output by adding filters.

     
  • jack

    jack - 2012-05-18

    I have added like this
    boost::log::core::get()->set_filter
    (
    boost::log::filters::attr<int>("Severity") <= warning
    );

    based on the different logic symbols( '<= ' )  we can do the filtering. we can log greater than, less than and equal to the warning severity . May I know the method which will give the greater than warning and less than the edebug as I said the severity levels in the previous post.

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.