|
Boost Users : |
Subject: Re: [Boost-users] Help me out from boost.log
From: Steven Woody (narkewoody_at_[hidden])
Date: 2011-01-23 12:23:29
On 22 January 2011 02:06, Tarcisio Fedrizzi <tarcisio.fedrizzi_at_[hidden]> wrote:
> On 21/01/2011 18:42, Steven Woody wrote:
>>
>> Hi,
>
> Hi,
>>
>> I want to use boost.log and I succeeded in building it with bjam with
>> Visual Studio 2005. But I quickly found I cannot use it.
>>
>>
>> Below code are from the tutorial,
>>
>> #include<boost/log/core.hpp>
>> #include<boost/log/trivial.hpp>
>> #include<boost/log/filters.hpp>
>>
>>
>> logging::core::init_log_to_file(
>> keywords::file_name = "dsttest_%N.log",
>> keywords::rotation_size = 10 * 1024 * 1024,
>> keywords::time_based_rotation
>> = sinks::file::rotation_at_time_point(0, 0, 0),
>> keywords::format = "[%TimeStamp%]: %_%"
>> );
>> logging::core::get()->set_filter(
>> flt::attr<logging::trivial::severity_level>("Severity")
>> >= loggin::trivial::debug
>> );
>>
>> but the compiler (vc++ 8.0) just complains:
>>
>> error C2653: 'logging' : is not a class or namespace name
>> error C2653: 'keywords' : is not a class or namespace name
>> ...
>
> look here
> http://boost-log.sourceforge.net/libs/log/doc/html/log/how_to_read.html
Thanks for this! I changed the code accordingly to:
boost::log::init_log_to_file(
boost::log::keywords::file_name = "dsttest_%N.log",
boost::log::keywords::rotation_size = 10 * 1024 * 1024,
boost::log::keywords::time_based_rotation
= boost::log::sinks::file::rotation_at_time_point(0, 0, 0),
boost::log::keywords::format = "[%TimeStamp%]: %_%"
);
boost::log::core::get()->set_filter(
boost::log::filters::attr<boost::log::trivial::severity_level>("Severity")
>= boost::log::trivial::debug
);
it seems solved the namespace problem, but I then got some other errors:
1>d:\woody\svn\fox3-dst\trunk\test\dsttest.cpp(30) : error C2039:
'init_log_to_file' : is not a member of 'boost::log_mt_nt5'
1>d:\woody\svn\fox3-dst\trunk\test\dsttest.cpp(35) : error C2039:
'format' : is not a member of 'boost::log_mt_nt5::keywords'
1>d:\woody\svn\fox3-dst\trunk\test\dsttest.cpp(35) : error C2065:
'format' : undeclared identifier
1>d:\woody\svn\fox3-dst\trunk\test\dsttest.cpp(30) : error C3861:
'init_log_to_file': identifier not found
What's wrong now?
>>
>> I tried to use boost::log::logging, but it did not help.
>>
>> Then I decided to try the most simple code:
>>
>> BOOST_LOG_TRIVIAL(debug)<< "hello boost.log";
>>
>> it passed the compiler but not the linker:
>>
>> libboost_log-vc80-mt-gd-1_45.lib(trivial.obj) : error LNK2019:
>> unresolved external symbol "class boost::system::error_category const
>> & __cdecl boost::system::generic_category(void)"
>> (?generic_category_at_system@boost@@YAABVerror_category_at_12@XZ) referenced
>> in function "void __cdecl boost::system::`dynamic initializer for
>> 'posix_category''(void)" (??__Eposix_category_at_system@boost@@YAXXZ)
>> ....
>
> you probably need to link the boost::system library in order to
> use the log library.
What you mean 'link the boost::system" library? I manually linked in
the stage/lib/libboost_system-vc80-mt*.lib, but it did not help.
Looking for your further reply and thank you anyway!
>>
>> Please help me! Thanks in advance.
>>
> Bye,
> Tarch.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
-- Life is the only flaw in an otherwise perfect nonexistence -- Schopenhauer narke public key at http://subkeys.pgp.net:11371 (narkewoody_at_[hidden])
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net